From: solar Date: Fri, 14 May 2010 03:59:27 +0000 (+0000) Subject: s/stdin/stream to make function actually work. Thanks to Kevin of OSDev.org for point... X-Git-Tag: v0.5~96 X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=e9a6658165caf38491a04d17a04accec11a3696c s/stdin/stream to make function actually work. Thanks to Kevin of OSDev.org for pointing this out. --- diff --git a/functions/stdio/fgets.c b/functions/stdio/fgets.c index f763e33..a3c41e9 100644 --- a/functions/stdio/fgets.c +++ b/functions/stdio/fgets.c @@ -21,16 +21,16 @@ char * fgets( char * _PDCLIB_restrict s, int size, struct _PDCLIB_file_t * _PDCL *s = '\0'; return s; } - if ( _PDCLIB_prepread( stdin ) == EOF ) + if ( _PDCLIB_prepread( stream ) == EOF ) { return NULL; } char * dest = s; - while ( ( ( *dest = stdin->buffer[stdin->bufidx++] ) != '\n' ) && --size > 0 ) + while ( ( ( *dest = stream->buffer[stream->bufidx++] ) != '\n' ) && --size > 0 ) { - if ( stdin->bufidx == stdin->bufend ) + if ( stream->bufidx == stream->bufend ) { - if ( _PDCLIB_fillbuffer( stdin ) == EOF ) + if ( _PDCLIB_fillbuffer( stream ) == EOF ) { /* EOF adds \0, error leaves target indeterminate, so we can just add the \0 anyway.