3 size_t wcsnrtombs(char *restrict dst
, const wchar_t **restrict wcs
, size_t wn
, size_t n
, mbstate_t *restrict st
)
7 const wchar_t *ws
= *wcs
;
9 if (!dst
) s
= buf
, n
= sizeof buf
;
12 while ( ws
&& n
&& ( (n2
=wn
)>=n
|| n2
>32 ) ) {
15 l
= wcsrtombs(s
, &ws
, n2
, 0);
27 if (ws
) while (n
&& wn
) {
28 l
= wcrtomb(s
, *ws
, 0);
35 /* safe - this loop runs fewer than sizeof(buf) times */