]> pd.if.org Git - pdclib.old/blob - functions/stdio/vscanf.c
Add _cbprintf/_vcbprintf (callback based printf formatters)
[pdclib.old] / functions / stdio / vscanf.c
1 /* $Id$ */
2
3 /* vscanf( const char *, va_list arg )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <stdio.h>
10 #include <stdarg.h>
11
12 #ifndef REGTEST
13 #include <_PDCLIB_io.h>
14
15 int _PDCLIB_vscanf_unlocked( const char * _PDCLIB_restrict format,
16                              _PDCLIB_va_list arg )
17 {
18     return _PDCLIB_vfscanf_unlocked( stdin, format, arg );
19 }
20
21 int vscanf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg )
22 {
23     return vfscanf( stdin, format, arg );
24 }
25
26 #endif
27
28 #ifdef TEST
29 #define _PDCLIB_FILEID "stdio/vscanf.c"
30 #define _PDCLIB_FILEIO
31
32 #include <_PDCLIB_test.h>
33
34 static int testscanf( FILE * stream, const char * format, ... )
35 {
36     int i;
37     va_list arg;
38     va_start( arg, format );
39     i = vscanf( format, arg );
40     va_end( arg );
41     return i;
42 }
43
44 int main( void )
45 {
46     FILE * source;
47     TESTCASE( ( source = freopen( testfile, "wb+", stdin ) ) != NULL );
48 #include "scanf_testcases.h"
49     TESTCASE( fclose( source ) == 0 );
50     TESTCASE( remove( testfile ) == 0 );
51     return TEST_RESULTS;
52 }
53
54 #endif