80180f57f08edf126e530c1a7227a95aaa1a485d
[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
30 static int testprintf( char * s, size_t n, const char * format, ... )
31 {
32     int i;
33     va_list arg;
34     va_start( arg, format );
35     i = vsprintf( s, format, arg );
36     va_end( arg );
37     return i;
38 }
39
40 int main( void )
41 {
42     char buffer[100];
43 #include "printf_testcases.incl"
44     return TEST_RESULTS;
45 }
46
47 #endif