]> pd.if.org Git - pdclib.old/blob - functions/stdio/scanf.c
Namespace cleanliness: Rename all ***_unlocked functions to _PDCLIB_***_unlocked.
[pdclib.old] / functions / stdio / scanf.c
1 /* $Id$ */
2
3 /* scanf( const char *, ... )
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_scanf_unlocked( const char * _PDCLIB_restrict format, ... )
16 {
17     va_list ap;
18     va_start( ap, format );
19     return _PDCLIB_vfscanf_unlocked( stdin, format, ap );
20 }
21
22 int scanf( const char * _PDCLIB_restrict format, ... )
23 {
24     va_list ap;
25     va_start( ap, format );
26     return vfscanf( stdin, format, ap );
27 }
28
29 #endif
30
31 #ifdef TEST
32 #define _PDCLIB_FILEID "stdio/scanf.c"
33 #define _PDCLIB_FILEIO
34
35 #include <_PDCLIB_test.h>
36
37 #define testscanf( stream, format, ... ) scanf( format, __VA_ARGS__ )
38
39 int main( void )
40 {
41     FILE * source;
42     TESTCASE( ( source = freopen( testfile, "wb+", stdin ) ) != NULL );
43 #include "scanf_testcases.h"
44     TESTCASE( fclose( source ) == 0 );
45     TESTCASE( remove( testfile ) == 0 );
46     return TEST_RESULTS;
47 }
48
49 #endif