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