]> pd.if.org Git - pdclib.old/blob - functions/stdio/vsprintf.c
[gandr] s/__lp64__/__LP64__/ to match GCC define
[pdclib.old] / 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, 
16               const char * _PDCLIB_restrict format, 
17               va_list arg )
18 {
19     return vsnprintf( s, SIZE_MAX, format, arg ); /* TODO: Replace with a non-checking call */
20 }
21
22 #endif
23
24 #ifdef TEST
25 #define _PDCLIB_FILEID "stdio/vsprintf.c"
26 #define _PDCLIB_STRINGIO
27 #include <stdint.h>
28 #include <stddef.h>
29 #include <_PDCLIB_test.h>
30
31 static int testprintf( char * s, const char * format, ... )
32 {
33     int i;
34     va_list arg;
35     va_start( arg, format );
36     i = vsprintf( s, format, arg );
37     va_end( arg );
38     return i;
39 }
40
41 int main( void )
42 {
43     char target[100];
44 #include "printf_testcases.h"
45     return TEST_RESULTS;
46 }
47
48 #endif