summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c13
1 files changed, 13 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.
*/