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
;
10 if (!dst
) s
= buf
, n
= sizeof buf
;
13 while ( ws
&& n
&& ( (n2
=wn
)>=n
|| n2
>32 ) ) {
16 l
= wcsrtombs(s
, &ws
, n2
, 0);
26 wn
= ws
? wn
- (ws
- tmp_ws
) : 0;
29 if (ws
) while (n
&& wn
) {
30 l
= wcrtomb(s
, *ws
, 0);
37 /* safe - this loop runs fewer than sizeof(buf) times */