diff options
Diffstat (limited to 'userland/libc/stdio/ungetc.c')
-rw-r--r-- | userland/libc/stdio/ungetc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/userland/libc/stdio/ungetc.c b/userland/libc/stdio/ungetc.c new file mode 100644 index 0000000..8d649bc --- /dev/null +++ b/userland/libc/stdio/ungetc.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +int ungetc(int c, FILE *stream) { + if (stream->has_buffered_char) + return EOF; + stream->buffered_char = c; + stream->has_buffered_char = 1; + return c; +} |