netinet/in.h: add IPPROTO_MH
[uclibc-ng.git] / libc / stdio / _rfill.c
blobd2b3de593e9206c702091e3c4457a309b34958c7
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.
6 */
8 #include "_stdio.h"
10 #ifdef __STDIO_BUFFERS
12 /* Read some data into the buffer.
13 * Returns number of bytes read into the buffer.
14 * If 0 is returned, then either EOF or ERROR.
15 * Side effects are those of _stdio_READ.
18 size_t attribute_hidden __stdio_rfill(register FILE *__restrict stream)
20 size_t rv;
22 __STDIO_STREAM_VALIDATE(stream);
23 assert(stream->__filedes >= -2);
24 assert(__STDIO_STREAM_IS_READING(stream));
25 assert(!__STDIO_STREAM_BUFFER_RAVAIL(stream)); /* Buffer must be empty. */
26 assert(__STDIO_STREAM_BUFFER_SIZE(stream)); /* Must have a buffer. */
27 assert(!(stream->__modeflags & __FLAG_UNGOT));
28 #ifdef __UCLIBC_HAS_STDIO_GETC_MACRO__
29 assert(stream->__bufgetc_u == stream->__bufstart);
30 #endif
32 rv = __stdio_READ(stream, stream->__bufstart,
33 stream->__bufend - stream->__bufstart);
34 stream->__bufpos = stream->__bufstart;
35 stream->__bufread = stream->__bufstart + rv;
37 __STDIO_STREAM_VALIDATE(stream);
38 return rv;
41 #endif