blob: 476a5d8d24b5f4a4727684859f350778b9612917 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include <ctype.h> // for tolower
#include <libc.h> // for __unused
#include <locale.h> // for locale_t
#include <sys/cdefs.h>
int strcasecmp(const char *s1, const char *s2)
{
unsigned char c1, c2;
while (*s1 && *s2) {
c1 = (unsigned char)tolower((unsigned char)*s1);
c2 = (unsigned char)tolower((unsigned char)*s2);
if (c1 != c2)
return c1 - c2;
s1++;
s2++;
}
return (unsigned char)tolower((unsigned char)*s1) - (unsigned char)tolower((unsigned char)*s2);
}
__weak int strcasecmp_l(const char *s1, const char *s2, locale_t __unused locale)
{
return strcasecmp(s1, s2);
}
|