summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/wcsrtombs.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/wcsrtombs.c')
-rw-r--r--newlib/libc/stdlib/wcsrtombs.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/wcsrtombs.c b/newlib/libc/stdlib/wcsrtombs.c
new file mode 100644
index 000000000..22512c0b4
--- /dev/null
+++ b/newlib/libc/stdlib/wcsrtombs.c
@@ -0,0 +1,22 @@
+#include <wchar.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <reent.h>
+#include <errno.h>
+
+size_t
+wcsrtombs (char *dst, const wchar_t **src, size_t len, mbstate_t *ps)
+{
+ int retval = 0;
+ _REENT_CHECK_MISC(_REENT);
+
+ retval = _wcstombs_r (_REENT, dst, *src, len, ps);
+
+ if (retval == -1)
+ {
+ _REENT->_errno = EILSEQ;
+ return (size_t)(-1);
+ }
+ else
+ return (size_t)retval;
+}