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
14 size_t wcsrtombs(char *restrict s, const wchar_t **restrict ws, size_t n, mbstate_t *restrict st)
20 for (n=0, ws2=*ws; *ws2; ws2++) {
22 l = wcrtomb(buf, *ws2, 0);
23 if (!(l+1)) return -1;
29 while (n>=4 && **ws) {
31 l = wcrtomb(s, **ws, 0);
32 if (!(l+1)) return -1;
43 l = wcrtomb(buf, **ws, 0);
44 if (!(l+1)) return -1;