[or-cvs] add tor_strisprint() back in, this time with comments.

arma at seul.org arma at seul.org
Wed Mar 15 23:35:57 UTC 2006


Update of /home2/or/cvsroot/tor/src/common
In directory moria:/home/arma/work/onion/cvs/tor/src/common

Modified Files:
	util.c util.h 
Log Message:
add tor_strisprint() back in, this time with comments.


Index: util.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.252
retrieving revision 1.253
diff -u -p -d -r1.252 -r1.253
--- util.c	15 Mar 2006 19:17:46 -0000	1.252
+++ util.c	15 Mar 2006 23:35:55 -0000	1.253
@@ -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.
  */

Index: util.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/common/util.h,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -p -d -r1.157 -r1.158
--- util.h	15 Mar 2006 19:17:46 -0000	1.157
+++ util.h	15 Mar 2006 23:35:55 -0000	1.158
@@ -90,6 +90,7 @@ extern int dmalloc_free(const char *file
 #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);



More information about the tor-commits mailing list