Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/waterbox/libc/functions/stdio/printf.c
2 views
1
/* printf( 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
#include "_PDCLIB_io.h"
12
13
int printf( const char * _PDCLIB_restrict format, ... )
14
{
15
int rc;
16
va_list ap;
17
va_start( ap, format );
18
rc = vfprintf( stdout, format, ap );
19
va_end( ap );
20
return rc;
21
}
22
23
int _PDCLIB_printf_unlocked( const char * _PDCLIB_restrict format, ... )
24
{
25
int rc;
26
va_list ap;
27
va_start( ap, format );
28
rc = _PDCLIB_vfprintf_unlocked( stdout, format, ap );
29
va_end( ap );
30
return rc;
31
}
32
33
#endif
34
35
#ifdef TEST
36
#define _PDCLIB_FILEID "stdio/printf.c"
37
#define _PDCLIB_FILEIO
38
#include <stdint.h>
39
#include <stddef.h>
40
41
#include "_PDCLIB_test.h"
42
43
#define testprintf( stream, ... ) printf( __VA_ARGS__ )
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
56
57