12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include "_stdio.h"
- wint_t ungetwc(wint_t c, register FILE *stream)
- {
- __STDIO_AUTO_THREADLOCK_VAR;
- __STDIO_AUTO_THREADLOCK(stream);
- __STDIO_STREAM_VALIDATE(stream);
-
- if ((!__STDIO_STREAM_IS_WIDE_READING(stream)
- && __STDIO_STREAM_TRANS_TO_READ(stream, __FLAG_WIDE))
- || ((stream->__modeflags & __FLAG_UNGOT)
- && ((stream->__modeflags & 1) || stream->__ungot[1]))
- || (c == WEOF)
- ) {
- c = WEOF;
- } else {
-
-
-
- stream->__ungot[1] = 1;
- stream->__ungot[(++stream->__modeflags) & 1] = c;
-
- __STDIO_STREAM_CLEAR_EOF(stream);
- }
- __STDIO_STREAM_VALIDATE(stream);
- __STDIO_AUTO_THREADUNLOCK(stream);
- return c;
- }
- libc_hidden_def(ungetwc)
|