home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/c/RCS/stricmp,v $
- * $Date: 1996/04/19 21:26:42 $
- * $Revision: 1.1 $
- * $State: Rel $
- * $Author: simon $
- *
- * $Log: stricmp,v $
- * Revision 1.1 1996/04/19 21:26:42 simon
- * Initial revision
- *
- ***************************************************************************/
-
- static const char rcs_id[] = "$Id: stricmp,v 1.1 1996/04/19 21:26:42 simon Rel $";
-
- #include <string.h>
- #include <ctype.h>
-
- int
- stricmp (register const char *s1, register const char *s2)
-
- {
- 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);
- }
-
- int
- strnicmp (register const char *s1, register const char *s2, register size_t n)
-
- {
- 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);
- }
-