OSDN Git Service

* libc/stdio/vfprintf.c: Include ../stdlib/local.h. Replace call to
[pf3gnuchains/pf3gnuchains3x.git] / newlib / libc / stdlib / wctob.c
1 #include <reent.h>
2 #include <wchar.h>
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <string.h>
6 #include "local.h"
7
8 int
9 wctob (wint_t c)
10 {
11   mbstate_t mbs;
12   int retval = 0;
13   unsigned char pwc;
14
15   /* Put mbs in initial state. */
16   memset (&mbs, '\0', sizeof (mbs));
17
18   _REENT_CHECK_MISC(_REENT);
19
20   retval = __wctomb (_REENT, &pwc, c, __locale_charset (), &mbs);
21
22   if (c == EOF || retval != 1)
23     return WEOF;
24   else
25     return (int)pwc;
26 }