• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* vfprintf.c
2  *
3  * $Id: vfprintf.c,v 1.1 2008/08/11 22:41:55 keithmarshall Exp $
4  *
5  * Provides an implementation of the "vfprintf" 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 "vfprintf" will normally be invoked by calling
14  * "__mingw_vfprintf()" in preference to a direct reference to "vfprintf()"
15  * itself; this leaves the MSVCRT implementation as the default, which
16  * will be deployed when user code invokes "vfprint()".  Users who then
17  * wish to use this implementation may either call "__mingw_vfprintf()"
18  * directly, or may use conditional preprocessor defines, to redirect
19  * references to "vfprintf()" to "__mingw_vfprintf()".
20  *
21  * Compiling this module with "-D INSTALL_AS_DEFAULT" will change this
22  * recommended convention, such that references to "vfprintf()" in user
23  * code will ALWAYS be redirected to "__mingw_vfprintf()"; if this option
24  * is adopted, then users wishing to use the MSVCRT implementation of
25  * "vfprintf()" 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_vfprintf()"; 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 __vfprintf (FILE *, const APICHAR *, va_list) __MINGW_NOTHROW;
48 
__vfprintf(FILE * stream,const APICHAR * fmt,va_list argv)49 int __cdecl __vfprintf(FILE *stream, const APICHAR *fmt, va_list argv)
50 {
51   register int retval;
52 
53   _lock_file( stream );
54   retval = __pformat( PFORMAT_TO_FILE | PFORMAT_NOLIMIT, stream, 0, fmt, argv );
55   _unlock_file( stream );
56 
57   return retval;
58 }
59