mirror of https://git.musl-libc.org/git/musl
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
252 B
19 lines
252 B
#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) {
|
|
FUNLOCK(f);
|
|
return EOF;
|
|
}
|
|
|
|
*--f->rpos = c;
|
|
f->flags &= ~F_EOF;
|
|
|
|
FUNLOCK(f);
|
|
return c;
|
|
}
|
|
|