]> andersk Git - moira.git/blobdiff - lib/strs.c
added the function lowercase()
[moira.git] / lib / strs.c
index 5af89ce77124c37d109b9e4cb0b80abc404f0adb..15459b47fb838f94eec127caff3395885c27d5cc 100644 (file)
@@ -4,6 +4,8 @@
  *     $Header$
  *
  *     Copyright (C) 1987 by the Massachusetts Institute of Technology
+ *     For copying and distribution information, please see the file
+ *     <mit-copyright.h>.
  *
  *     Miscellaneous string functions.
  */
@@ -12,6 +14,7 @@
 static char *rcsid_strs_c = "$Header$";
 #endif lint
 
+#include <mit-copyright.h>
 #include <sys/types.h>
 #include <strings.h>
 #include <ctype.h>
@@ -71,20 +74,28 @@ char *strtrim(save)
     return s;
 }
 
-/*
- * Case insensitive string compare.
- */
 
-int cistrcmp(cp1, cp2)
-    char *cp1, *cp2;
+/* Modify a string for all of the letters to be uppercase. */
+
+char *uppercase(s)
+char *s;
 {
-    register int c1, c2;
-    
-    do {
-       if (isupper(c1 = (*cp1++))) c1 = tolower(c1);
-       if (isupper(c2 = (*cp2++))) c2 = tolower(c2);
-       if (c1 != c2) return c1-c2;
-    } while (c1 && c2);
-    return 0;
+    register char *p;
+
+    for (p = s; *p; p++)
+      if (islower(*p))
+       *p = toupper(*p);
+    return(s);
 }
 
+
+char *lowercase(s)
+char *s;
+{
+    register char *p;
+
+    for (p = s; *p; p++)
+      if (isupper(*p))
+       *p = tolower(*p);
+    return(s);
+}
This page took 0.031709 seconds and 4 git commands to generate.