1 /* vsprintf.c
2 *
3 * $Id: vsprintf.c,v 1.1 2008/08/11 22:41:55 keithmarshall Exp $
4 *
5 * Provides an implementation of the "vsprintf" function, conforming
6 * generally to C99 and SUSv3/POSIX specifications, with extensions
7 * to support Microsoft's non-standard format specifications. This
8 * is included in libmingwex.a, whence it may replace the Microsoft
9 * function of the same name.
10 *
11 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
12 *
13 * This implementation of "vsprintf" will normally be invoked by calling
14 * "__mingw_vsprintf()" in preference to a direct reference to "vsprintf()"
15 * itself; this leaves the MSVCRT implementation as the default, which
16 * will be deployed when user code invokes "vsprint()". Users who then
17 * wish to use this implementation may either call "__mingw_vsprintf()"
18 * directly, or may use conditional preprocessor defines, to redirect
19 * references to "vsprintf()" to "__mingw_vsprintf()".
20 *
21 * Compiling this module with "-D INSTALL_AS_DEFAULT" will change this
22 * recommended convention, such that references to "vsprintf()" in user
23 * code will ALWAYS be redirected to "__mingw_vsprintf()"; if this option
24 * is adopted, then users wishing to use the MSVCRT implementation of
25 * "vsprintf()" will be forced to use a "back-door" mechanism to do so.
26 * Such a "back-door" mechanism is provided with MinGW, allowing the
27 * MSVCRT implementation to be called as "__msvcrt_vsprintf()"; however,
28 * since users may not expect this behaviour, a standard libmingwex.a
29 * installation does not employ this option.
30 *
31 *
32 * This is free software. You may redistribute and/or modify it as you
33 * see fit, without restriction of copyright.
34 *
35 * This software is provided "as is", in the hope that it may be useful,
36 * but WITHOUT WARRANTY OF ANY KIND, not even any implied warranty of
37 * MERCHANTABILITY, nor of FITNESS FOR ANY PARTICULAR PURPOSE. At no
38 * time will the author accept any form of liability for any damages,
39 * however caused, resulting from the use of this software.
40 *
41 */
42 #include <stdio.h>
43 #include <stdarg.h>
44
45 #include "mingw_pformat.h"
46
47 int __cdecl __vsprintf (APICHAR *, const APICHAR *, va_list) __MINGW_NOTHROW;
48
__vsprintf(APICHAR * buf,const APICHAR * fmt,va_list argv)49 int __cdecl __vsprintf(APICHAR *buf, const APICHAR *fmt, va_list argv)
50 {
51 register int retval;
52 buf[retval = __pformat( PFORMAT_NOLIMIT, buf, 0, fmt, argv )] = '\0';
53 return retval;
54 }
55