Path: blob/master/waterbox/libc/functions/stdio/_PDCLIB_fillbuffer.c
2 views
/* _PDCLIB_fillbuffer( FILE * stream )12This file is part of the Public Domain C Library (PDCLib).3Permission is granted to use, modify, and / or redistribute at will.4*/56#include <stdio.h>78#ifndef REGTEST9#include "_PDCLIB_glue.h"10#include "_PDCLIB_io.h"1112int _PDCLIB_fillbuffer( FILE * stream )13{14size_t bytesRead;15bool ok = stream->ops->read( stream->handle, stream->buffer, stream->bufsize,16&bytesRead);1718if( ok ) {19if( bytesRead == 0 ) {20stream->status |= _PDCLIB_EOFFLAG;21return EOF;22}23stream->pos.offset += bytesRead;24stream->bufend = bytesRead;25stream->bufidx = 0;26return 0;27} else {28stream->status |= _PDCLIB_ERRORFLAG;29return EOF;30}31}3233#endif3435#ifdef TEST36#include "_PDCLIB_test.h"3738int main( void )39{40/* Testing covered by ftell.c */41return TEST_RESULTS;42}4344#endif45464748