]> pd.if.org Git - pdclib/blob - functions/stdio/fscanf.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / stdio / fscanf.c
1 /* fscanf( FILE *, 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_fscanf_unlocked( FILE * _PDCLIB_restrict stream, 
14                      const char * _PDCLIB_restrict format, ... )
15 {
16     int rc;
17     va_list ap;
18     va_start( ap, format );
19     rc = _PDCLIB_vfscanf_unlocked( stream, format, ap );
20     va_end( ap );
21     return rc;
22 }
23
24 int fscanf( FILE * _PDCLIB_restrict stream, 
25             const char * _PDCLIB_restrict format, ... )
26 {
27     int rc;
28     va_list ap;
29     va_start( ap, format );
30     rc = vfscanf( stream, format, ap );
31     va_end( ap );
32     return rc;
33 }
34
35 #endif
36
37 #ifdef TEST
38 #define _PDCLIB_FILEID "stdio/fscanf.c"
39 #define _PDCLIB_FILEIO
40
41 #include "_PDCLIB_test.h"
42
43 #define testscanf( stream, format, ... ) fscanf( stream, format, __VA_ARGS__ )
44
45 int main( void )
46 {
47     FILE * source;
48     TESTCASE( ( source = tmpfile() ) != NULL );
49 #include "scanf_testcases.h"
50     TESTCASE( fclose( source ) == 0 );
51     return TEST_RESULTS;
52 }
53
54 #endif