1 #include "stdio_impl.h"
7 wint_t ungetwc(wint_t c, FILE *f)
9 unsigned char mbc[MB_LEN_MAX];
12 if (c == WEOF) return c;
14 /* Try conversion early so we can fail without locking if invalid */
15 if (!isascii(c) && (l = wctomb((void *)mbc, c)) < 0)
22 if ((!f->rend && __toread(f)) || f->rpos < f->buf - UNGET + l) {
27 if (isascii(c)) *--f->rpos = c;
28 else memcpy(f->rpos -= l, mbc, l);