#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/lib/libc/locale/wctob.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
+#include "xlocale_private.h"
+
#include <limits.h>
#include <stdio.h>
#include <wchar.h>
#include "mblocal.h"
int
-wctob(wint_t c)
+wctob_l(wint_t c, locale_t loc)
{
static const mbstate_t initial;
mbstate_t mbs = initial;
char buf[MB_LEN_MAX];
- if (c == WEOF || __wcrtomb(buf, c, &mbs) != 1)
+ NORMALIZE_LOCALE(loc);
+ if (c == WEOF || loc->__lc_ctype->__wcrtomb(buf, c, &mbs, loc) != 1)
return (EOF);
return ((unsigned char)*buf);
}
+
+int
+wctob(wint_t c)
+{
+ return wctob_l(c, __current_locale());
+}