]>
diplodocus.org Git - nmh/blob - sbr/strcasecmp.c
3 * strcasecmp.c -- compare strings, ignoring case
11 * Our version of strcasecmp has to deal with NULL strings.
12 * Once that is fixed in the rest of the code, we can use the
13 * native version, instead of this one.
17 strcasecmp (const char *s1
, const char *s2
)
19 const unsigned char *us1
, *us2
;
21 us1
= (const unsigned char *) s1
,
22 us2
= (const unsigned char *) s2
;
29 while (tolower(*us1
) == tolower(*us2
++))
32 return (tolower(*us1
) - tolower(*--us2
));
37 strncasecmp (const char *s1
, const char *s2
, size_t n
)
39 const unsigned char *us1
, *us2
;
42 us1
= (const unsigned char *) s1
,
43 us2
= (const unsigned char *) s2
;
46 if (tolower(*us1
) != tolower(*us2
++))
47 return (tolower(*us1
) - tolower(*--us2
));