2 * This code was written by Rich Felker in 2010; no copyright is claimed.
3 * This code is in the public domain. Attribution is appreciated but
9 size_t wcsrtombs(char *restrict s, const wchar_t **restrict ws, size_t n, mbstate_t *restrict st)
15 for (n=0, ws2=*ws; *ws2; ws2++) {
17 l = wcrtomb(buf, *ws2, 0);
18 if (!(l+1)) return -1;
25 if (**ws-1u >= 0x7fu) {
31 l = wcrtomb(s, **ws, 0);
32 if (!(l+1)) return -1;
42 if (**ws-1u >= 0x7fu) {
48 l = wcrtomb(buf, **ws, 0);
49 if (!(l+1)) return -1;