blob: 927c1a7a83c5b151f751f7576d930937e48eaaad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <reent.h>
#include <wchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "local.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 (_REENT, &pwc, c, __locale_charset (), &mbs);
if (c == EOF || retval != 1)
return WEOF;
else
return (int)pwc;
}
|