repo.or.cz
/
newlib-cygwin.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git]
/
newlib
/
libc
/
stdlib
/
wctob.c
blob
61365a178a151c5195e16bba5f5431f15d4aba02
1
#include <reent.h>
2
#include <wchar.h>
3
#include <stdio.h>
4
#include <string.h>
5
#include <limits.h>
6
#include
"local.h"
7
8
int
9
wctob
(
wint_t
wc
)
10
{
11
struct
_reent
*
reent
;
12
mbstate_t
mbs
;
13
unsigned char
pmb
[
MB_LEN_MAX
];
14
15
if
(
wc
==
WEOF
)
16
return
EOF
;
17
18
/* Put mbs in initial state. */
19
memset
(&
mbs
,
'\0'
,
sizeof
(
mbs
));
20
21
reent
=
_REENT
;
22
_REENT_CHECK_MISC
(
reent
);
23
24
return
__WCTOMB
(
reent
, (
char
*)
pmb
,
wc
, &
mbs
) ==
1
? (
int
)
pmb
[
0
] :
EOF
;
25
}