musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/multibyte/mbtowc.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011年02月12日 00:22:29 -0500
committerRich Felker <dalias@aerifal.cx>2011年02月12日 00:22:29 -0500
commit0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 (patch)
tree6eaef0d8a720fa3da580de87b647fff796fe80b3 /src/multibyte/mbtowc.c
downloadmusl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.tar.gz
initial check-in, version 0.5.0v0.5.0
Diffstat (limited to 'src/multibyte/mbtowc.c')
-rw-r--r--src/multibyte/mbtowc.c 19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/multibyte/mbtowc.c b/src/multibyte/mbtowc.c
new file mode 100644
index 00000000..bdcaeb3c
--- /dev/null
+++ b/src/multibyte/mbtowc.c
@@ -0,0 +1,19 @@
+/*
+ * This code was written by Rich Felker in 2010; no copyright is claimed.
+ * This code is in the public domain. Attribution is appreciated but
+ * unnecessary.
+ */
+
+#include <stdlib.h>
+#include <inttypes.h>
+#include <wchar.h>
+#include <errno.h>
+
+#include "internal.h"
+
+int mbtowc(wchar_t *wc, const char *s, size_t n)
+{
+ mbstate_t st = { 0 };
+ n = mbrtowc(wc, s, n, &st);
+ return n+2 ? n : -1;
+}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月26日 23:57:45 +0000

AltStyle によって変換されたページ (->オリジナル) /