Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | #include "stdio_impl.h" |
| 2 | |
Rich Felker | e3cd6c5 | 2011-03-28 01:14:44 -0400 | [diff] [blame] | 3 | int __overflow(FILE *f, int _c) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 4 | { |
Rich Felker | e3cd6c5 | 2011-03-28 01:14:44 -0400 | [diff] [blame] | 5 | unsigned char c = _c; |
| 6 | if (!f->wend && __towrite(f)) return EOF; |
| 7 | if (f->wpos < f->wend && c != f->lbf) return *f->wpos++ = c; |
| 8 | if (f->write(f, &c, 1)!=1) return EOF; |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 9 | return c; |
| 10 | } |