From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- src/stdio/__toread.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/stdio/__toread.c (limited to 'src/stdio/__toread.c') 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 + +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(); +} -- cgit v1.2.3