date and time created 88/07/21 17:35:28 by marc
authorMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Fri, 22 Jul 1988 08:35:28 +0000 (00:35 -0800)
committerMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Fri, 22 Jul 1988 08:35:28 +0000 (00:35 -0800)
SCCS-vsn: local/toolchest/ksh/shlib/convert.c 1.1

usr/src/local/toolchest/ksh/shlib/convert.c [new file with mode: 0644]

diff --git a/usr/src/local/toolchest/ksh/shlib/convert.c b/usr/src/local/toolchest/ksh/shlib/convert.c
new file mode 100644 (file)
index 0000000..5c30389
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+
+ *      Copyright (c) 1984, 1985, 1986 AT&T
+ *      All Rights Reserved
+
+ *      THIS IS UNPUBLISHED PROPRIETARY SOURCE 
+ *      CODE OF AT&T.
+ *      The copyright notice above does not 
+ *      evidence any actual or intended
+ *      publication of such source code.
+
+ */
+/* @(#)convert.c       1.1 */
+
+/*
+ *   CONVERT.C
+ *
+ *
+ *   LTOU (STR1, STR2)
+ *        Copy STR1 to STR2, changing lower case to upper case.
+ *
+ *   UTOL (STR1, STR2)
+ *        Copy STR1 to STR2, changing upper case to lower case.
+ *
+ */
+
+#ifdef KSHELL
+#include       "shtype.h"
+#else
+#include       <ctype.h>
+#endif /* KSHELL */
+
+/* 
+ *   LTOU (STR1, STR2)
+ *        char *STR1;
+ *        char *STR2;
+ *
+ *   Copy STR1 to STR2, converting uppercase alphabetics to
+ *   lowercase.  STR2 should be big enough to hold STR1.
+ *
+ *   STR1 and STR2 may point to the same place.
+ *
+ */
+
+void ltou(str1,str2)
+char *str1,*str2;
+{
+       register char *s,*d;
+       for(s=str1,d=str2;*s;s++,d++)
+       {
+               if(islower(*s))
+                       *d = toupper(*s);
+               else
+                       *d = *s;
+       }
+       *d = 0;
+}
+
+
+/*
+ *   UTOL (STR1, STR2)
+ *        char *STR1;
+ *        char *STR2;
+ *
+ *   Copy STR1 to STR2, converting lowercase alphabetics to
+ *   uppercase.  STR2 should be big enough to hold STR1.
+ *
+ *   STR1 and STR2 may point to the same place.
+ *
+ */
+
+void utol(str1,str2)
+char *str1,*str2;
+{
+       register char *s,*d;
+       for(s=str1,d=str2;*s;s++,d++)
+       {
+               if(isupper(*s))
+                       *d = tolower(*s);
+               else
+                       *d = *s;
+       }
+       *d = 0;
+}
+