]> pd.if.org Git - pdclib/blob - functions/stdio/sprintf.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / stdio / sprintf.c
1 /* sprintf( char *, 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 <stdint.h>
9 #include <stdarg.h>
10
11 #ifndef REGTEST
12
13 int sprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, ...)
14 {
15     int rc;
16     va_list ap;
17     va_start( ap, format );
18     rc = vsnprintf( s, SIZE_MAX, format, ap ); /* TODO: replace with non-checking call */
19     va_end( ap );
20     return rc;
21 }
22
23 #endif
24
25 #ifdef TEST
26 #define _PDCLIB_FILEID "stdio/sprintf.c"
27 #define _PDCLIB_STRINGIO
28 #include <stddef.h>
29
30 #include "_PDCLIB_test.h"
31
32 #define testprintf( s, ... ) sprintf( s, __VA_ARGS__ )
33
34 int main( void )
35 {
36     char target[100];
37 #include "printf_testcases.h"
38     return TEST_RESULTS;
39 }
40
41 #endif