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 <wchar_private.h>
7
8
9wint_t
10__btowc(int c)
11{
12	static mbstate_t internalMbState;
13	char character = (char)c;
14	wchar_t wc;
15
16	if (c == EOF)
17		return WEOF;
18
19	if (c == '\0')
20		return L'\0';
21
22	{
23		int byteCount = __mbrtowc(&wc, &character, 1, &internalMbState);
24
25		if (byteCount != 1)
26			return WEOF;
27	}
28
29	return wc;
30}
31
32
33B_DEFINE_WEAK_ALIAS(__btowc, btowc);
34