X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Fvfscanf.c;h=eeae09eec4cde33a69a1b55f6fb607fdfae6c2c1;hb=d6f1494a4f38a212b29a13ee713885058dcf0fe7;hp=e1c8b4b40efd8fd28040cbf47600647ab0e9e4bb;hpb=00379f785fe102b41c75761d4c1f2a1dbb8d1fde;p=pdclib diff --git a/functions/stdio/vfscanf.c b/functions/stdio/vfscanf.c index e1c8b4b..eeae09e 100644 --- a/functions/stdio/vfscanf.c +++ b/functions/stdio/vfscanf.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* vfscanf( FILE *, const char *, va_list ) This file is part of the Public Domain C Library (PDCLib). @@ -42,7 +40,7 @@ int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict forma { ++status.i; } - if ( ! feof( stream ) ) /* TODO: Check EOF status directly */ + if ( ! feof( stream ) ) { ungetc( c, stream ); } @@ -50,10 +48,10 @@ int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict forma else { /* Non-whitespace char in format string: Match verbatim */ - if ( ( ( c = getc( stream ) ) != *format ) || feof( stream ) ) /* TODO: Check EOF status directly */ + if ( ( ( c = getc( stream ) ) != *format ) || feof( stream ) ) { /* Matching error */ - if ( ! feof( stream ) && ! ferror( stream ) ) /* TODO: Check EOF status directly */ + if ( ! feof( stream ) && ! ferror( stream ) ) { ungetc( c, stream ); } @@ -88,11 +86,12 @@ int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict forma #endif #ifdef TEST -#include <_PDCLIB_test.h> +#define _PDCLIB_FILEID "stdio/vfscanf.c" +#define _PDCLIB_FILEIO -#include "scan_test.h" +#include "_PDCLIB_test.h" -static int SCANFUNC( FILE * stream, char const * format, ... ) +static int testscanf( FILE * stream, char const * format, ... ) { va_list ap; va_start( ap, format ); @@ -103,8 +102,10 @@ static int SCANFUNC( FILE * stream, char const * format, ... ) int main( void ) { -#include "fscan_sources.incl" -#include "scanf_testcases.incl" + FILE * source; + TESTCASE( ( source = tmpfile() ) != NULL ); +#include "scanf_testcases.h" + TESTCASE( fclose( source ) == 0 ); return TEST_RESULTS; }