1 /*
2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
5
6 #include <errno.h>
7
8 #include <errno_private.h>
9 #include <wchar_private.h>
10
11
12 int
__mbtowc(wchar_t * pwc,const char * s,size_t n)13 __mbtowc(wchar_t* pwc, const char* s, size_t n)
14 {
15 static mbstate_t internalMbState;
16
17 int result = __mbrtowc(pwc, s, n, &internalMbState);
18 if (result == -2) {
19 __set_errno(EILSEQ);
20 result = -1;
21 }
22
23 return result;
24 }
25
26
27 B_DEFINE_WEAK_ALIAS(__mbtowc, mbtowc);
28