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 <stdint.h>
7
8#include <wchar_private.h>
9
10
11int
12__wctob(wint_t c)
13{
14	char internalBuffer[MB_LEN_MAX];
15
16	int32_t byteCount = __wcrtomb(internalBuffer, c, NULL);
17	if (byteCount != 1)
18		return EOF;
19
20	return (int)(unsigned char)internalBuffer[0];
21}
22
23
24B_DEFINE_WEAK_ALIAS(__wctob, wctob);
25