diff options
Diffstat (limited to 'newlib/libc/stdlib/mbsrtowcs.c')
-rw-r--r-- | newlib/libc/stdlib/mbsrtowcs.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/mbsrtowcs.c b/newlib/libc/stdlib/mbsrtowcs.c new file mode 100644 index 000000000..256ab0d7b --- /dev/null +++ b/newlib/libc/stdlib/mbsrtowcs.c @@ -0,0 +1,24 @@ +#include <wchar.h> +#include <stdlib.h> +#include <stdio.h> +#include <reent.h> +#include <errno.h> + +size_t +mbsrtowcs(wchar_t *dst, const char **src, size_t len, mbstate_t *ps) +{ + int retval = 0; + mbstate_t internal; + + _REENT_CHECK_MISC(_REENT); + + retval = _mbstowcs_r (_REENT, dst, *src, len, ps != NULL ? ps : &internal); + + if (retval == -1) + { + _REENT->_errno = EILSEQ; + return (size_t)(-1); + } + else + return (size_t)retval; +} |