Browse Source

add strupper function

svn:r4934
Nick Mathewson 20 years ago
parent
commit
c4b3bf06c6
2 changed files with 11 additions and 0 deletions
  1. 10 0
      src/common/util.c
  2. 1 0
      src/common/util.h

+ 10 - 0
src/common/util.c

@@ -299,6 +299,16 @@ void tor_strlower(char *s)
   }
   }
 }
 }
 
 
+/** Convert all alphabetic characters in the nul-terminated string <b>s</b> to
+ * lowercase. */
+void tor_strupper(char *s)
+{
+  while (*s) {
+    *s = toupper(*s);
+    ++s;
+  }
+}
+
 /* Compares the first strlen(s2) characters of s1 with s2.  Returns as for
 /* Compares the first strlen(s2) characters of s1 with s2.  Returns as for
  * strcmp.
  * strcmp.
  */
  */

+ 1 - 0
src/common/util.h

@@ -69,6 +69,7 @@ char *_tor_strndup(const char *file, const int line, const char *s, size_t n);
 /* String manipulation */
 /* String manipulation */
 #define HEX_CHARACTERS "0123456789ABCDEFabcdef"
 #define HEX_CHARACTERS "0123456789ABCDEFabcdef"
 void tor_strlower(char *s);
 void tor_strlower(char *s);
+void tor_strupper(char *s);
 int strcmpstart(const char *s1, const char *s2);
 int strcmpstart(const char *s1, const char *s2);
 int strcasecmpstart(const char *s1, const char *s2);
 int strcasecmpstart(const char *s1, const char *s2);
 int strcmpend(const char *s1, const char *s2);
 int strcmpend(const char *s1, const char *s2);