1 #include "stdio_impl.h"
5 wint_t __fgetwc_unlocked(FILE *);
7 wchar_t *fgetws(wchar_t *restrict s
, int n
, FILE *restrict f
)
15 /* Setup a dummy errno so we can detect EILSEQ. This is
16 * the only way to catch encoding errors in the form of a
17 * partial character just before EOF. */
20 wint_t c
= __fgetwc_unlocked(f
);
26 if (ferror(f
) || errno
==EILSEQ
) p
= s
;
30 return (p
== s
) ? NULL
: s
;
33 weak_alias(fgetws
, fgetws_unlocked
);