summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-07-31 18:01:37 +0000
committerNick Mathewson <nickm@torproject.org>2006-07-31 18:01:37 +0000
commitea0f5ec8adab0c268895d416c94b3f648c81ef31 (patch)
tree0542baa92cc22cdcb59a850a982dcc49d6f6537d /src
parentd934607069c77d6cf4caf9061e43d6d20c5aa111 (diff)
downloadtor-ea0f5ec8adab0c268895d416c94b3f648c81ef31.tar.gz
tor-ea0f5ec8adab0c268895d416c94b3f648c81ef31.zip
r6980@Kushana: nickm | 2006-07-31 13:18:22 -0400
Add a utility function to verify that a string has been through strlower. svn:r6959
Diffstat (limited to 'src')
-rw-r--r--src/common/util.c13
-rw-r--r--src/common/util.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 98d6867bc6..82ebfaf0bf 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -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.
*/
diff --git a/src/common/util.h b/src/common/util.h
index bc21d2051f..fb1534469c 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -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);