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;
24 while (n
>=4 && **ws
) {
26 l
= wcrtomb(s
, **ws
, 0);
27 if (!(l
+1)) return -1;
38 l
= wcrtomb(buf
, **ws
, 0);
39 if (!(l
+1)) return -1;