]> pd.if.org Git - pdclib/blob - functions/stdio/scanf.c
PDCLIB-16: Add _unlocked variations of all I/O routines; move work into these versions
[pdclib] / 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
14 int scanf_unlocked( const char * _PDCLIB_restrict format, ... )
15 {
16     va_list ap;
17     va_start( ap, format );
18     return vfscanf_unlocked( stdin, format, ap );
19 }
20
21 int scanf( const char * _PDCLIB_restrict format, ... )
22 {
23     va_list ap;
24     va_start( ap, format );
25     return vfscanf( stdin, format, ap );
26 }
27
28 #endif
29
30 #ifdef TEST
31 #define _PDCLIB_FILEID "stdio/scanf.c"
32 #define _PDCLIB_FILEIO
33
34 #include <_PDCLIB_test.h>
35
36 #define testscanf( stream, format, ... ) scanf( format, __VA_ARGS__ )
37
38 int main( void )
39 {
40     FILE * source;
41     TESTCASE( ( source = freopen( testfile, "wb+", stdin ) ) != NULL );
42 #include "scanf_testcases.h"
43     TESTCASE( fclose( source ) == 0 );
44     TESTCASE( remove( testfile ) == 0 );
45     return TEST_RESULTS;
46 }
47
48 #endif