1
0
mirror of https://github.com/fluencelabs/musl synced 2025-06-09 13:01:34 +00:00

20 lines
252 B
C
Raw Normal View History

2011-02-12 00:22:29 -05:00
#include "stdio_impl.h"
int ungetc(int c, FILE *f)
{
if (c == EOF) return c;
FLOCK(f);
if ((!f->rend && __toread(f)) || f->rpos <= f->buf - UNGET) {
2011-02-12 00:22:29 -05:00
FUNLOCK(f);
return EOF;
}
*--f->rpos = c;
f->flags &= ~F_EOF;
FUNLOCK(f);
return c;
}