/* * Implementation by Devin Reade * * $Id: case.c,v 1.1 1997/02/28 05:12:50 gdr Exp $ * * This file is formatted with tab stops every 8 columns. */ #ifdef __ORCAC__ segment "libc_str__"; #endif #pragma optimize 0 #pragma debug 0 #pragma memorymodel 0 #include #include #undef TOLOWER #define TOLOWER(c) isupper(c) ? _tolower(c) : c int strcasecmp (const char *s1, const char *s2) { unsigned int c1, c2; for (;;) { c1 = TOLOWER(*s1); c2 = TOLOWER(*s2); if (c1 == '\0' && c2 == '\0') { return 0; } else if (c1 == c2) { s1++; s2++; } else { /* don't do subtraction -- see man page */ return (c1 > c2) ? 1 : -1; } } } int strncasecmp (const char *s1, const char *s2, size_t n) { unsigned int c1, c2; size_t i; for (i=0; i c2) ? 1 : -1; } } return 0; } short stricmp (const char *s1, const char *s2) { return strcasecmp(s1, s2); } short strincmp (const char *s1, const char *s2, unsigned n) { return strncasecmp(s1, s2, n); }