6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
7 * For copying and distribution information, please see the file
10 * Miscellaneous string functions.
14 static char *rcsid_strs_c = "$Header$";
17 #include <mit-copyright.h>
18 #include <sys/types.h>
22 extern char *malloc(), *realloc();
25 * Random string functions which should be in the C library..
29 * Make a copy of a string.
37 /* Kludge for sloppy string semantics */
39 printf("NULL != \"\" !!!!\r\n");
45 p = malloc((u_int)len);
46 if (p) bcopy(s, p, len);
50 * Trim whitespace off both ends of a string.
58 while (isspace(*s)) s++;
59 /* skip to end of string */
65 for (t = s; *t; t++) continue;
78 * Case insensitive string compare.
81 int cistrcmp(cp1, cp2)
87 if (isupper(c1 = (*cp1++))) c1 = tolower(c1);
88 if (isupper(c2 = (*cp2++))) c2 = tolower(c2);
89 if (c1 != c2) return c1-c2;