3 /* vsscanf( const char *, const char *, va_list arg )
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 vsscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, va_list arg )
17 /* TODO: This function should interpret format as multibyte characters. */
18 struct _PDCLIB_status_t status;
24 status.s = (char *) s;
28 va_copy( status.arg, arg );
30 while ( *format != '\0' )
33 if ( ( *format != '%' ) || ( ( rc = _PDCLIB_scan( format, &status ) ) == format ) )
35 /* No conversion specifier, match verbatim */
36 if ( isspace( *format ) )
38 /* Whitespace char in format string: Skip all whitespaces */
39 /* No whitespaces in input do not result in matching error */
40 while ( isspace( *status.s ) )
48 /* Non-whitespace char in format string: Match verbatim */
49 if ( *status.s != *format )
51 if ( *status.s == '\0' && status.n == 0 )
53 /* Early input error */
69 /* NULL return code indicates error */
72 if ( ( *status.s == '\n' ) && ( status.n == 0 ) )
78 /* Continue parsing after conversion specifier */
89 #include <_PDCLIB_test.h>
91 #include "scan_test.h"
93 static int SCANFUNC( char const * stream, char const * format, ... )
96 va_start( ap, format );
97 int result = vsscanf( stream, format, ap );
104 #include "sscan_sources.incl"
105 #include "scanf_testcases.incl"