musl/src/stdio/__overflow.c

11 lines
240 B
C
Raw Normal View History

2011-02-12 00:22:29 -05:00
#include "stdio_impl.h"
int __overflow(FILE *f, int _c)
2011-02-12 00:22:29 -05:00
{
unsigned char c = _c;
if (!f->wend && __towrite(f)) return EOF;
if (f->wpos < f->wend && c != f->lbf) return *f->wpos++ = c;
if (f->write(f, &c, 1)!=1) return EOF;
2011-02-12 00:22:29 -05:00
return c;
}