X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..2be56ee90c5c5bee77895b8787a43e894249002b:/locale/FreeBSD/wctype.c diff --git a/locale/FreeBSD/wctype.c b/locale/FreeBSD/wctype.c index 2db1c9b..f94c133 100644 --- a/locale/FreeBSD/wctype.c +++ b/locale/FreeBSD/wctype.c @@ -27,21 +27,17 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $"); +#include "xlocale_private.h" + #include #include #include - -#undef iswctype -int -iswctype(wint_t wc, wctype_t charclass) -{ - - return (__istype(wc, charclass)); -} +#include 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()); }