summaryrefslogtreecommitdiff
path: root/src/wchar/btowc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wchar/btowc.c')
-rw-r--r--src/wchar/btowc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/wchar/btowc.c b/src/wchar/btowc.c
new file mode 100644
index 00000000..dd986119
--- /dev/null
+++ b/src/wchar/btowc.c
@@ -0,0 +1,21 @@
+#include <wchar.h>
+#include "locale.h"
+#include "string.h"
+
+wint_t btowc(int c)
+{
+ char *l = setlocale(LC_CTYPE, NULL);
+
+ if (!strcmp(l, "C") || !strcmp(l, "POSIX")) {
+ if (c <= 127) {
+ return (unsigned char)c;
+ }
+ }
+
+ /* conversion */
+ return WEOF;
+}
+
+/*
+STDC(199409)
+*/