1 /* vsscanf( const char *, const char *, va_list )
3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
13 int vsscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, va_list arg )
15 /* TODO: This function should interpret format as multibyte characters. */
16 struct _PDCLIB_status_t status;
22 status.s = (char *) s;
26 va_copy( status.arg, arg );
28 while ( *format != '\0' )
31 if ( ( *format != '%' ) || ( ( rc = _PDCLIB_scan( format, &status ) ) == format ) )
33 /* No conversion specifier, match verbatim */
34 if ( isspace( *format ) )
36 /* Whitespace char in format string: Skip all whitespaces */
37 /* No whitespaces in input do not result in matching error */
38 while ( isspace( *status.s ) )
46 /* Non-whitespace char in format string: Match verbatim */
47 if ( *status.s != *format )
49 if ( *status.s == '\0' && status.n == 0 )
51 /* Early input error */
67 /* NULL return code indicates error */
70 if ( ( *status.s == '\n' ) && ( status.n == 0 ) )
76 /* Continue parsing after conversion specifier */
87 #define _PDCLIB_FILEID "stdio/vsscanf.c"
88 #define _PDCLIB_STRINGIO
90 #include <_PDCLIB_test.h>
92 static int testscanf( char const * stream, char const * format, ... )
95 va_start( ap, format );
96 int result = vsscanf( stream, format, ap );
104 #include "scanf_testcases.h"