a2d8441bae9900a145b9e0ce0eb77106b30ad304
[fw/pdclib] / functions / stdio / snprintf.c
1 /* $Id$ */
2
3 /* snprintf( char *, size_t, const char *, ... )
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 <stdarg.h>
11
12 #ifndef REGTEST
13
14 int snprintf( char * _PDCLIB_restrict s, size_t n, const char * _PDCLIB_restrict format, ...)
15 {
16     int rc;
17     va_list ap;
18     va_start( ap, format );
19     rc = vsnprintf( s, n, format, ap );
20     va_end( ap );
21     return rc;
22 }
23
24 #endif
25
26 #ifdef TEST
27 #include <_PDCLIB_test.h>
28
29 #include <string.h>
30 #include <limits.h>
31
32 #define testprintf( s, n, format, ... ) snprintf( s, n, format, __VA_ARGS__ )
33
34 int main( void )
35 {
36     char buffer[100];
37 #include "printf_testcases.incl"
38     return TEST_RESULTS;
39 }
40
41 #endif