1 --- strcasecmp.c.bsdnew 2009-11-18 18:24:33.000000000 -0800
2 +++ strcasecmp.c 2009-11-18 18:24:33.000000000 -0800
3 @@ -33,38 +33,59 @@ static char sccsid[] = "@(#)strcasecmp.c
5 __FBSDID("$FreeBSD: src/lib/libc/string/strcasecmp.c,v 1.8 2009/02/03 17:58:20 danger Exp $");
7 +#include "xlocale_private.h"
12 typedef unsigned char u_char;
15 -strcasecmp(const char *s1, const char *s2)
16 +strcasecmp_l(s1, s2, loc)
17 + const char *s1, *s2;
21 *us1 = (const u_char *)s1,
22 *us2 = (const u_char *)s2;
24 - while (tolower(*us1) == tolower(*us2++))
25 + NORMALIZE_LOCALE(loc);
26 + while (tolower_l(*us1, loc) == tolower_l(*us2++, loc))
29 - return (tolower(*us1) - tolower(*--us2));
30 + return (tolower_l(*us1, loc) - tolower_l(*--us2, loc));
34 -strncasecmp(const char *s1, const char *s2, size_t n)
35 +strcasecmp(const char *s1, const char *s2)
37 + return strcasecmp_l(s1, s2, __current_locale());
41 +strncasecmp_l(s1, s2, n, loc)
42 + const char *s1, *s2;
46 + NORMALIZE_LOCALE(loc);
49 *us1 = (const u_char *)s1,
50 *us2 = (const u_char *)s2;
53 - if (tolower(*us1) != tolower(*us2++))
54 - return (tolower(*us1) - tolower(*--us2));
55 + if (tolower_l(*us1, loc) != tolower_l(*us2++, loc))
56 + return (tolower_l(*us1, loc) - tolower_l(*--us2, loc));
65 +strncasecmp(const char *s1, const char *s2, size_t n)
67 + return strncasecmp_l(s1, s2, n, __current_locale());