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