Reworked scanf() testing. General cleanups.
[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 #define _PDCLIB_FILEID "stdio/vsprintf.c"
24 #define _PDCLIB_STRINGIO
25
26 #include <_PDCLIB_test.h>
27
28 static int testprintf( char * s, const char * format, ... )
29 {
30     int i;
31     va_list arg;
32     va_start( arg, format );
33     i = vsprintf( s, format, arg );
34     va_end( arg );
35     return i;
36 }
37
38 int main( void )
39 {
40     char target[100];
41 #include "printf_testcases.h"
42     return TEST_RESULTS;
43 }
44
45 #endif