Loading...
--- strcasestr.c.orig 2003-05-20 15:23:54.000000000 -0700 +++ strcasestr.c 2005-02-18 18:48:55.000000000 -0800 @@ -37,6 +37,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/lib/libc/string/strcasestr.c,v 1.3 2002/03/21 18:44:54 obrien Exp $"); +#include "xlocale_private.h" + #include <ctype.h> #include <string.h> @@ -44,22 +46,31 @@ * Find the first occurrence of find in s, ignore case. */ char * -strcasestr(s, find) +strcasestr_l(s, find, loc) const char *s, *find; + locale_t loc; { char c, sc; size_t len; + NORMALIZE_LOCALE(loc); if ((c = *find++) != 0) { - c = tolower((unsigned char)c); + c = tolower_l((unsigned char)c, loc); len = strlen(find); do { do { if ((sc = *s++) == 0) return (NULL); - } while ((char)tolower((unsigned char)sc) != c); - } while (strncasecmp(s, find, len) != 0); + } while ((char)tolower_l((unsigned char)sc, loc) != c); + } while (strncasecmp_l(s, find, len, loc) != 0); s--; } return ((char *)s); } + +char * +strcasestr(s, find) + const char *s, *find; +{ + return strcasestr_l(s, find, __current_locale()); +} |