]> diplodocus.org Git - nmh/commitdiff
Add ToLower(s) and ToUpper(s).
authorRalph Corderoy <ralph@inputplus.co.uk>
Sat, 22 Oct 2016 18:43:12 +0000 (19:43 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 22 Oct 2016 18:43:12 +0000 (19:43 +0100)
h/utils.h
sbr/utils.c

index db563cb4568f21b13a4b7b72d3b2a75b583c97db..b57a4d883b31a33ee6de4fea41235b159ce8d31b 100644 (file)
--- a/h/utils.h
+++ b/h/utils.h
@@ -65,6 +65,8 @@ char *nmh_strcasestr (const char *, const char *);
 
 bool EndsWithC(char *s, int c);
 void TrimSuffixC(char *s, int c);
+void ToLower(char *s);
+void ToUpper(char *s);
 
 /*
  * See if a string contains 8 bit characters (use isascii() for the test).
index f5f2057032e3d1cf0afa2991ecf736e8a226a11b..8f6ff76e8a817097b6460201c456b544936fbdc6 100644 (file)
@@ -379,6 +379,26 @@ void TrimSuffixC(char *s, int c)
 }
 
 
+/* ToLower runs all of s through tolower(3). */
+void ToLower(char *s)
+{
+    unsigned char *b;
+
+    for (b = (unsigned char *)s; (*b = tolower(*b)); b++)
+        ;
+}
+
+
+/* ToUpper runs all of s through toupper(3). */
+void ToUpper(char *s)
+{
+    unsigned char *b;
+
+    for (b = (unsigned char *)s; (*b = toupper(*b)); b++)
+        ;
+}
+
+
 int
 nmh_init(const char *argv0, int read_context) {
     int status = OK;