4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-16 03:19:54 +08:00
Christopher Faylor 576593dd72 * libc/stdlib/mbrlen.c: Change include order to prevent compiler errors when
defining _mbrtowc.
* libc/stdlib/mbsinit.c: Ditto.
* libc/stdlib/mbsrtowcs.c: Ditto.
* libc/stdlib/wcrtomb.c: Ditto.
* libc/stdlib/wcsrtombs.c: Ditto.
* libc/stdlib/wctob.c: Ditto.
* libc/stdlib/mbrlen.c: Change include order to prevent compiler errors when
defining _mbrtowc.
* libc/stdlib/mbsinit.c: Ditto.
* libc/stdlib/mbsrtowcs.c: Ditto.
2003-12-05 06:13:44 +00:00

25 lines
385 B
C

#include <reent.h>
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
int
wctob (wint_t c)
{
mbstate_t mbs;
int retval = 0;
unsigned char pwc;
/* Put mbs in initial state. */
memset (&mbs, '\0', sizeof (mbs));
_REENT_CHECK_MISC(_REENT);
retval = _wctomb_r (_REENT, &pwc, c, &mbs);
if (c == EOF || retval != 1)
return WEOF;
else
return (int)pwc;
}