1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
3 * GNU Library General Public License (LGPL) version 2 or later.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
10 #ifdef __UCLIBC_MJN3_ONLY__
11 #warning CONSIDER: Do we really need a seperate rfill function?
14 #ifdef __STDIO_BUFFERS
16 /* Read some data into the buffer.
17 * Returns number of bytes read into the buffer.
18 * If 0 is returned, then either EOF or ERROR.
19 * Side effects are those of _stdio_READ.
22 size_t attribute_hidden
__stdio_rfill(register FILE *__restrict stream
)
26 __STDIO_STREAM_VALIDATE(stream
);
27 assert(stream
->__filedes
>= -1);
28 assert(__STDIO_STREAM_IS_READING(stream
));
29 assert(!__STDIO_STREAM_BUFFER_RAVAIL(stream
)); /* Buffer must be empty. */
30 assert(__STDIO_STREAM_BUFFER_SIZE(stream
)); /* Must have a buffer. */
31 assert(!(stream
->__modeflags
& __FLAG_UNGOT
));
32 #ifdef __UCLIBC_HAS_STDIO_GETC_MACRO__
33 assert(stream
->__bufgetc_u
== stream
->__bufstart
);
36 rv
= __stdio_READ(stream
, stream
->__bufstart
,
37 stream
->__bufend
- stream
->__bufstart
);
38 stream
->__bufpos
= stream
->__bufstart
;
39 stream
->__bufread
= stream
->__bufstart
+ rv
;
41 __STDIO_STREAM_VALIDATE(stream
);