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 ) ) /* TODO: Check EOF status directly */
71 /* NULL return code indicates matching error */
76 /* Continue parsing after conversion specifier */
87 #include <_PDCLIB_test.h>
89 #include "scan_test.h"
91 static int SCANFUNC( FILE * stream, char const * format, ... )
94 va_start( ap, format );
95 int result = vfscanf( stream, format, ap );
102 #include "fscan_sources.incl"
103 #include "scanf_testcases.incl"