3 /* fgets( char *, int, FILE * )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 #define _PDCLIB_GLUE_H _PDCLIB_GLUE_H
14 #include <_PDCLIB_glue.h>
16 char * fgets( char * s, int size, struct _PDCLIB_file_t * stream )
20 /* TODO: This is the letter of the standard, but is it the right thing to do? */
24 if ( _PDCLIB_prepread( stdin ) == EOF )
29 while ( ( ( *dest = stdin->buffer[stdin->bufidx++] ) != '\n' ) && --size > 0 )
31 if ( stdin->bufidx == stdin->bufend )
33 if ( _PDCLIB_fillbuffer( stdin ) == EOF )
35 /* EOF adds \0, error leaves target indeterminate, so we can
36 just add the \0 anyway.
51 #include <_PDCLIB_test.h>
55 TESTCASE( NO_TESTDRIVER );