diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2002-11-22 03:05:27 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2002-11-22 03:05:27 +0000 |
commit | c386ddb4d8a1b076d94ebe8b85ca5d0dd124892b (patch) | |
tree | e30c9d77393721491f4a3a42e223980352b72ff8 /libc/misc/wchar/wstdio.c | |
parent | 2b8a8dc7144328f301390f13fa560d29a410e34f (diff) |
Ok... here's the summary:
Hopefully locale support will build when cross compiling now. Collation is
still not supported, but that's what I'm currently working on. In the
next couple of days, I'll probably put up a couple of files for download
that will save people the trouble of generating all the glibc locales.
Added *wprintf functions, although they currently don't support floating
point. That will be fixed when I rewrite _dtostr... or possibly before.
Added the wcsto{inttype} functions.
Added iconv() and a mini iconv utility. The require locale support and
only provide for conversions involving the various unicode encodings
{ UCS-4*, UCS-2*, UTF-32*, UTF-16*, UTF-8 }, the 8-bit codesets built
with the locale data, and the internal WCHAR_T.
Diffstat (limited to 'libc/misc/wchar/wstdio.c')
-rw-r--r-- | libc/misc/wchar/wstdio.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libc/misc/wchar/wstdio.c b/libc/misc/wchar/wstdio.c index a4984f3c1..dfeb35c30 100644 --- a/libc/misc/wchar/wstdio.c +++ b/libc/misc/wchar/wstdio.c @@ -26,6 +26,13 @@ * * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */ +/* Nov 21, 2002 + * + * Reimplement fputwc and fputws in terms of internal function _wstdio_fwrite. + */ + + + /* * ANSI/ISO C99 says @@ -288,6 +295,9 @@ UNLOCKED(wchar_t *,fgetws,(wchar_t *__restrict ws, int n, UNLOCKED(wint_t,fputwc,(wchar_t wc, FILE *stream),(wc, stream)) { +#if 1 + return _wstdio_fwrite(&wc, 1, stream) ? wc : WEOF; +#else size_t n; char buf[MB_LEN_MAX]; @@ -298,9 +308,10 @@ UNLOCKED(wint_t,fputwc,(wchar_t wc, FILE *stream),(wc, stream)) } stream->modeflags |= __FLAG_WIDE; - return (((n = wcrtomb(buf, wc, &stream->state)) != ((size_t)-1)) /* EILSEQ */ - && (_stdio_fwrite(buf, n, stream) != n))/* Didn't write everything. */ + return (((n = wcrtomb(buf, wc, &stream->state)) != ((size_t)-1)) /* !EILSEQ */ + && (_stdio_fwrite(buf, n, stream) == n))/* and wrote everything. */ ? wc : WEOF; +#endif } strong_alias(fputwc_unlocked,putwc_unlocked); @@ -324,6 +335,11 @@ UNLOCKED_STREAM(wint_t,putwchar,(wchar_t wc),(wc),stdout) UNLOCKED(int,fputws,(const wchar_t *__restrict ws, register FILE *__restrict stream),(ws, stream)) { +#if 1 + size_t n = wcslen(ws); + + return (_wstdio_fwrite(ws, n, stream) == n) ? 0 : -1; +#else size_t n; char buf[64]; @@ -347,6 +363,7 @@ UNLOCKED(int,fputws,(const wchar_t *__restrict ws, } return 1; +#endif } #endif |