3 /* vfscanf( FILE *, const char *, va_list )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
15 int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, va_list arg )
17 /* TODO: This function should interpret format as multibyte characters. */
18 struct _PDCLIB_status_t status;
27 status.stream = stream;
28 va_copy( status.arg, arg );
30 while ( *format != '\0' )
33 if ( ( *format != '%' ) || ( ( rc = _PDCLIB_scan( format, &status ) ) == format ) )
36 /* No conversion specifier, match verbatim */
37 if ( isspace( *format ) )
39 /* Whitespace char in format string: Skip all whitespaces */
40 /* No whitespaces in input does not result in matching error */
41 while ( isspace( c = getc( stream ) ) )
45 if ( ! feof( stream ) ) /* TODO: Check EOF status directly */
52 /* Non-whitespace char in format string: Match verbatim */
53 if ( ( ( c = getc( stream ) ) != *format ) || feof( stream ) ) /* TODO: Check EOF status directly */
56 if ( ! feof( stream ) && ! ferror( stream ) ) /* TODO: Check EOF status directly */
60 else if ( status.n == 0 )
75 /* NULL return code indicates matching error */
80 /* Continue parsing after conversion specifier */
91 #include <_PDCLIB_test.h>
93 #include "scan_test.h"
95 static int SCANFUNC( FILE * stream, char const * format, ... )
98 va_start( ap, format );
99 int result = vfscanf( stream, format, ap );
106 #include "fscan_sources.incl"
107 #include "scanf_testcases.incl"