2018-07-30 04:40:03 +00:00
|
|
|
# ifdef __ORCAC__
|
|
|
|
# pragma noroot
|
|
|
|
# endif
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
2018-07-31 02:35:45 +00:00
|
|
|
int strcasecmp(const char *s1, const char *s2)
|
|
|
|
{
|
|
|
|
while (*s1 != '\0' && tolower(*s1) == tolower(*s2)) {
|
|
|
|
s1++;
|
|
|
|
s2++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (int)*s1 - (int)*s2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-30 04:40:03 +00:00
|
|
|
int strncasecmp(const char *s1, const char *s2, size_t n)
|
|
|
|
{
|
|
|
|
if (n == 0)
|
|
|
|
return 0;
|
|
|
|
|
2018-07-31 02:35:45 +00:00
|
|
|
while (n > 1 && *s1 != '\0' && tolower(*s1) == tolower(*s2)) {
|
2018-07-30 04:40:03 +00:00
|
|
|
s1++;
|
|
|
|
s2++;
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (int)*s1 - (int)*s2;
|
|
|
|
}
|