]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
r6980@Kushana: nickm | 2006-07-31 13:18:22 -0400
authorNick Mathewson <nickm@torproject.org>
Mon, 31 Jul 2006 18:01:37 +0000 (18:01 +0000)
committerNick Mathewson <nickm@torproject.org>
Mon, 31 Jul 2006 18:01:37 +0000 (18:01 +0000)
 Add a utility function to verify that a string has been through strlower.

svn:r6959

src/common/util.c
src/common/util.h

index 98d6867bc60460195065423edeec2bf224fb8bb0..82ebfaf0bf98e20f92a136f284c5b13b1346c94d 100644 (file)
@@ -337,6 +337,19 @@ tor_strisprint(const char *s)
   return 1;
 }
 
+/** Return 1 if no character in <b>s</b> is uppercase, else return 0.
+ */
+int
+tor_strisnonupper(const char *s)
+{
+  while (*s) {
+    if (! TOR_ISUPPER(*s))
+      return 0;
+    s++;
+  }
+  return 1;
+}
+
 /* Compares the first strlen(s2) characters of s1 with s2.  Returns as for
  * strcmp.
  */
index bc21d2051fb2da75789416fdb0a0d3c0a47fc8d2..fb1534469c977b8a4e9d83c490e703783555ee75 100644 (file)
@@ -97,6 +97,7 @@ extern int dmalloc_free(const char *file, const int line, void *pnt,
 void tor_strlower(char *s);
 void tor_strupper(char *s);
 int tor_strisprint(const char *s);
+int tor_strisnonupper(const char *s);
 int strcmpstart(const char *s1, const char *s2);
 int strcasecmpstart(const char *s1, const char *s2);
 int strcmpend(const char *s1, const char *s2);