diff options
Diffstat (limited to 'src/stdio/__toread.c')
-rw-r--r-- | src/stdio/__toread.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/stdio/__toread.c b/src/stdio/__toread.c new file mode 100644 index 0000000..f142ff0 --- /dev/null +++ b/src/stdio/__toread.c @@ -0,0 +1,19 @@ +#include <stdio_impl.h> + +int __toread(FILE *f) +{ + f->mode |= f->mode-1; + if (f->wpos != f->wbase) f->write(f, 0, 0); + f->wpos = f->wbase = f->wend = 0; + if (f->flags & F_NORD) { + f->flags |= F_ERR; + return EOF; + } + f->rpos = f->rend = f->buf + f->buf_size; + return (f->flags & F_EOF) ? EOF : 0; +} + +hidden void __toread_needs_stdio_exit() +{ + __stdio_exit_needed(); +} |