summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-03-15 23:35:55 +0000
committerRoger Dingledine <arma@torproject.org>2006-03-15 23:35:55 +0000
commit0e62befab8e4ece2f7b80a2755b7fb36521f5fe0 (patch)
treefa9024910180b35aed60eb4a7836903aa3322f8e
parent8d1f65a2225da5c3b9e4edaa712bd65617989324 (diff)
downloadtor-0e62befab8e4ece2f7b80a2755b7fb36521f5fe0.tar.gz
tor-0e62befab8e4ece2f7b80a2755b7fb36521f5fe0.zip
add tor_strisprint() back in, this time with comments.
svn:r6170
-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 2f001d753c..6bee50b975 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -329,6 +329,19 @@ tor_strupper(char *s)
}
}
+/** Return 1 if every character in <b>s</b> is printable, else return 0.
+ */
+int
+tor_strisprint(const char *s)
+{
+ while (*s) {
+ if (!TOR_ISPRINT(*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 ebcf70f7ec..cdcd64f6b4 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -90,6 +90,7 @@ extern int dmalloc_free(const char *file, const int line, void *pnt,
#define HEX_CHARACTERS "0123456789ABCDEFabcdef"
void tor_strlower(char *s);
void tor_strupper(char *s);
+int tor_strisprint(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);