3 /* vsnprintf( char *, size_t, const char *, va_list ap )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 #include <_PDCLIB_io.h>
15 int vsnprintf( char * _PDCLIB_restrict s,
17 const char * _PDCLIB_restrict format,
20 /* TODO: This function should interpret format as multibyte characters. */
21 struct _PDCLIB_status_t status;
31 va_copy( status.arg, arg );
33 while ( *format != '\0' )
36 if ( ( *format != '%' ) || ( ( rc = _PDCLIB_print( format, &status ) ) == format ) )
38 /* No conversion specifier, print verbatim */
41 s[ status.i ] = *format;
48 /* Continue parsing after conversion specifier */
63 #define _PDCLIB_FILEID "stdio/vsnprintf.c"
64 #define _PDCLIB_STRINGIO
66 #include <_PDCLIB_test.h>
68 static int testprintf( char * s, const char * format, ... )
72 va_start( arg, format );
73 i = vsnprintf( s, 100, format, arg );
81 #include "printf_testcases.h"