From fc00c656c96528112d05cf0edf8631bd5eaea446 Mon Sep 17 00:00:00 2001 From: Kacper Date: Sun, 7 Dec 2025 20:10:31 +0100 Subject: Add build system scaffolding and libc headers --- lib/libc/stdlib/btowc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/libc/stdlib/btowc.c (limited to 'lib/libc/stdlib/btowc.c') diff --git a/lib/libc/stdlib/btowc.c b/lib/libc/stdlib/btowc.c new file mode 100644 index 00000000..f16865b7 --- /dev/null +++ b/lib/libc/stdlib/btowc.c @@ -0,0 +1,18 @@ +#include +#include +#include + +#define CODEUNIT(c) (0xdfff & (signed char)(c)) + +wint_t btowc(int c) +{ + if ((unsigned char)c < 128U) { + return c; + } + + if (MB_CUR_MAX == 1 && c != EOF) { + return CODEUNIT(c); + } + + return WEOF; +} -- cgit v1.2.3