Reworked scanf() testing. General cleanups.
[fw/pdclib] / functions / stdio / vprintf.c
1 /* $Id$ */
2
3 /* vprintf( const char *, va_list arg )
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 vprintf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg )
15 {
16     return vfprintf( stdout, format, arg );
17 }
18
19 #endif
20
21 #ifdef TEST
22 #define _PDCLIB_FILEID "stdio/vprintf.c"
23 #define _PDCLIB_FILEIO
24
25 #include <_PDCLIB_test.h>
26
27 static int testprintf( FILE * stream, const char * format, ... )
28 {
29     int i;
30     va_list arg;
31     va_start( arg, format );
32     i = vprintf( format, arg );
33     va_end( arg );
34     return i;
35 }
36
37 int main( void )
38 {
39     FILE * target;
40     TESTCASE( ( target = freopen( testfile, "wb+", stdout ) ) != NULL );
41 #include "printf_testcases.h"
42     TESTCASE( fclose( target ) == 0 );
43     TESTCASE( remove( testfile ) == 0 );
44     return TEST_RESULTS;
45 }
46
47 #endif