Further streamlined testing.
[fw/pdclib] / functions / stdio / vsprintf.c
1 /* $Id$ */
2
3 /* vsprintf( char *, const char *, va_list ap )
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 <stdint.h>
11 #include <stdarg.h>
12
13 #ifndef REGTEST
14
15 int vsprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, va_list arg )
16 {
17     return vsnprintf( s, SIZE_MAX, format, arg ); /* TODO: Replace with a non-checking call */
18 }
19
20 #endif
21
22 #ifdef TEST
23 #include <_PDCLIB_test.h>
24
25 #include <limits.h>
26 #include <stdint.h>
27 #include <string.h>
28
29 static int testprintf( char * s, size_t n, const char * format, ... )
30 {
31     int i;
32     va_list arg;
33     va_start( arg, format );
34     i = vsprintf( s, format, arg );
35     va_end( arg );
36     return i;
37 }
38
39 #define TESTCASE_SPRINTF( x ) TESTCASE( x )
40
41 int main( void )
42 {
43     char buffer[100];
44 #include "printf_testcases.incl"
45     return TEST_RESULTS;
46 }
47
48 #endif