]> pd.if.org Git - pdclib/blob - functions/stdio/fprintf.c
Tyndur tests
[pdclib] / functions / stdio / fprintf.c
1 /* fprintf( 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
12 int fprintf( struct _PDCLIB_file_t * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... )
13 {
14     int rc;
15     va_list ap;
16     va_start( ap, format );
17     rc = vfprintf( stream, format, ap );
18     va_end( ap );
19     return rc;
20 }
21
22 #endif
23
24 #ifdef TEST
25 #include <stdint.h>
26 #include <stddef.h>
27 #define _PDCLIB_FILEID "stdio/fprintf.c"
28 #define _PDCLIB_FILEIO
29
30 #include "_PDCLIB_test.h"
31
32 #define testprintf( stream, ... ) fprintf( stream, __VA_ARGS__ )
33
34 int main( void )
35 {
36     FILE * target;
37     TESTCASE( ( target = tmpfile() ) != NULL );
38 #include "printf_testcases.h"
39     TESTCASE( fclose( target ) == 0 );
40     return TEST_RESULTS;
41 }
42
43 #endif