commit 2fa9d9d8e2580b0d8081184db9da3339a291b912
parent 5941ba58a5a6a8590c799e02977f4999a30d23e7
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 6 Nov 2022 19:27:41 +0100
libc/stdlib: Add wctomb()
Diffstat:
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/libc/objs/common-objs.mk b/src/libc/objs/common-objs.mk
@@ -90,6 +90,7 @@ COMMON_OBJS =\
stdlib/strtoll.$O\
stdlib/strtoul.$O\
stdlib/strtoull.$O\
+ stdlib/wctomb.$O\
string/strcat.$O\
string/strchr.$O\
string/strcmp.$O\
diff --git a/src/libc/stdlib/Makefile b/src/libc/stdlib/Makefile
@@ -30,6 +30,7 @@ OBJS =\
strtoll.$O\
strtoul.$O\
strtoull.$O\
+ wctomb.$O\
all: $(OBJS)
diff --git a/src/libc/stdlib/wctomb.c b/src/libc/stdlib/wctomb.c
@@ -0,0 +1,10 @@
+#include <stdlib.h>
+#include <wchar.h>
+
+#undef wctomb
+
+int
+wctomb(char *s, wchar_t wc)
+{
+ return wcrtomb(s, wc, NULL);
+}