mirror of
https://github.com/fluencelabs/musl
synced 2025-04-26 15:52:13 +00:00
15 lines
286 B
C
15 lines
286 B
C
|
#include <stdio_impl.h>
|
||
|
|
||
|
int __toread(FILE *f)
|
||
|
{
|
||
|
f->mode |= f->mode-1;
|
||
|
if (f->wpos > f->buf) f->write(f, 0, 0);
|
||
|
f->wpos = f->wbase = f->wend = 0;
|
||
|
if (f->flags & (F_EOF|F_NORD)) {
|
||
|
if (f->flags & F_NORD) f->flags |= F_ERR;
|
||
|
return EOF;
|
||
|
}
|
||
|
f->rpos = f->rend = f->buf;
|
||
|
return 0;
|
||
|
}
|