home *** CD-ROM | disk | FTP | other *** search
- #ifdef __STDC__
- static char sccs_id[] = "@(#) stricmp.c 1.0 " __DATE__ " HJR";
- #else
- static char sccs_id[] = "@(#) stricmp.c 1.0 23/9/91 HJR";
- #endif
-
- /* stricmp.c (c) Copyright 1990 H.Rogers */
-
- #ifndef __STDC__
- #include "sys/types.h"
- #endif
- #include <string.h>
- #include <ctype.h>
-
- #ifdef __STDC__
- int
- stricmp (register const char *s1, register const char *s2)
- #else
- int
- stricmp (s1, s2)
- register const char *s1;
- register const char *s2;
- #endif
- {
- register int i, j;
-
- do
- {
- i = *s1++, j = *s2++;
- i = isupper (i) ? _tolower (i) : i;
- j = isupper (j) ? _tolower (j) : j;
- }
- while (i && i == j);
-
- return (i - j);
- }
-
- #ifdef __STDC__
- int
- strnicmp (register const char *s1, register const char *s2, register size_t n)
- #else
- int
- strnicmp (s1, s2, n)
- register const char *s1;
- register const char *s2;
- register size_t n;
- #endif
- {
- register int i, j;
-
- if (!n)
- return (0);
-
- do
- {
- i = *s1++, j = *s2++;
- i = isupper (i) ? _tolower (i) : i;
- j = isupper (j) ? _tolower (j) : j;
- }
- while (i && i == j && --n);
-
- return (i - j);
- }
-