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