blob: 3bb37923abb847787878cf868d86bce570fb267e [file] [log] [blame]
Rich Felker0b44a032011-02-12 00:22:29 -05001#include "stdio_impl.h"
2
Rich Felkere3cd6c52011-03-28 01:14:44 -04003int __overflow(FILE *f, int _c)
Rich Felker0b44a032011-02-12 00:22:29 -05004{
Rich Felkere3cd6c52011-03-28 01:14:44 -04005 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 Felker0b44a032011-02-12 00:22:29 -05009 return c;
10}