--- wctype.c.bsdnew 2009-11-09 15:05:25.000000000 -0800 +++ wctype.c 2009-11-09 17:53:01.000000000 -0800 @@ -27,21 +27,17 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $"); +#include "xlocale_private.h" + #include <ctype.h> #include <string.h> #include <wctype.h> - -#undef iswctype -int -iswctype(wint_t wc, wctype_t charclass) -{ - - return (__istype(wc, charclass)); -} +#include <limits.h> wctype_t -wctype(const char *property) +wctype_l(const char *property, locale_t loc) { + _RuneLocale *rl; static const struct { const char *name; wctype_t mask; @@ -70,5 +66,23 @@ wctype(const char *property) while (props[i].name != NULL && strcmp(props[i].name, property) != 0) i++; - return (props[i].mask); + if (props[i].mask) + return (props[i].mask); + + NORMALIZE_LOCALE(loc); + rl = &loc->__lc_ctype->_CurrentRuneLocale; + if ((i = rl->__ncharclasses) > 0) { + _RuneCharClass *rp; + for (rp = rl->__charclasses; i-- > 0; rp++) { + if (strncmp(rp->__name, property, CHARCLASS_NAME_MAX) == 0) + return (rp->__mask); + } + } + return 0; +} + +wctype_t +wctype(const char *property) +{ + return wctype_l(property, __current_locale()); }