]> pd.if.org Git - pdclib.old/blob - functions/stdio/vprintf.c
[gandr] s/__lp64__/__LP64__/ to match GCC define
[pdclib.old] / 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 #include <_PDCLIB_io.h>
14
15 int _PDCLIB_vprintf_unlocked( const char * _PDCLIB_restrict format, 
16                               _PDCLIB_va_list arg )
17 {
18     return _PDCLIB_vfprintf_unlocked( stdout, format, arg );
19 }
20
21 int vprintf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg )
22 {
23     return vfprintf( stdout, format, arg );
24 }
25
26 #endif
27
28 #ifdef TEST
29 #define _PDCLIB_FILEID "stdio/vprintf.c"
30 #define _PDCLIB_FILEIO
31 #include <stdint.h>
32 #include <stddef.h>
33 #include <_PDCLIB_test.h>
34
35 static int testprintf( FILE * stream, const char * format, ... )
36 {
37     int i;
38     va_list arg;
39     va_start( arg, format );
40     i = vprintf( format, arg );
41     va_end( arg );
42     return i;
43 }
44
45 int main( void )
46 {
47     FILE * target;
48     TESTCASE( ( target = freopen( testfile, "wb+", stdout ) ) != NULL );
49 #include "printf_testcases.h"
50     TESTCASE( fclose( target ) == 0 );
51     TESTCASE( remove( testfile ) == 0 );
52     return TEST_RESULTS;
53 }
54
55 #endif