1 --- fputwc.c.orig 2004-11-25 11:38:34.000000000 -0800
2 +++ fputwc.c 2005-02-23 17:21:10.000000000 -0800
5 __FBSDID("$FreeBSD: src/lib/libc/stdio/fputwc.c,v 1.10 2004/07/20 08:27:27 tjr Exp $");
7 +#include "xlocale_private.h"
14 * Non-MT-safe version.
17 -__fputwc(wchar_t wc, FILE *fp)
18 +__private_extern__ wint_t
19 +__fputwc(wchar_t wc, FILE *fp, locale_t loc)
23 + struct __xlocale_st_runelocale *xrl = loc->__lc_ctype;
25 - if (MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX) {
26 + if (xrl->__mb_cur_max == 1 && wc > 0 && wc <= UCHAR_MAX) {
28 * Assume single-byte locale with no special encoding.
29 * A more careful test would be to check
31 *buf = (unsigned char)wc;
34 - if ((len = __wcrtomb(buf, wc, &fp->_extra->mbstate)) ==
35 + if ((len = xrl->__wcrtomb(buf, wc, &fp->_extra->mbstate, loc)) ==
43 - r = __fputwc(wc, fp);
44 + r = __fputwc(wc, fp, __current_locale());
51 +fputwc_l(wchar_t wc, FILE *fp, locale_t loc)
55 + NORMALIZE_LOCALE(loc);
58 + r = __fputwc(wc, fp, loc);