1 #ifndef __CURL_MPRINTF_H
2 #define __CURL_MPRINTF_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at http://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * licensed versions of the software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  ***************************************************************************/
24 
25 #include <stdarg.h>
26 #ifdef __ghs__
27 #include <stdio.h> /* needed for FILE */
28 #else
29 #include "nonghsheaders.h"
30 #endif
31 
32 #include "cafe/curl/curl.h"
33 
34 #ifdef  __cplusplus
35 extern "C" {
36 #endif
37 
38 CURL_EXTERN int curl_mprintf(const char *format, ...);
39 CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
40 CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
41 CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
42                                const char *format, ...);
43 CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
44 CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
45 CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
46 CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
47                                 const char *format, va_list args);
48 CURL_EXTERN char *curl_maprintf(const char *format, ...);
49 CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
50 
51 #ifdef _MPRINTF_REPLACE
52 # undef printf
53 # undef fprintf
54 # undef sprintf
55 # undef vsprintf
56 # undef snprintf
57 # undef vprintf
58 # undef vfprintf
59 # undef vsnprintf
60 # undef aprintf
61 # undef vaprintf
62 # define printf curl_mprintf
63 # define fprintf curl_mfprintf
64 #ifdef CURLDEBUG
65 /* When built with CURLDEBUG we define away the sprintf() functions since we
66    do not want internal code to be using them */
67 # define sprintf sprintf_was_used
68 # define vsprintf vsprintf_was_used
69 #else
70 # define sprintf curl_msprintf
71 # define vsprintf curl_mvsprintf
72 #endif
73 # define snprintf curl_msnprintf
74 # define vprintf curl_mvprintf
75 # define vfprintf curl_mvfprintf
76 # define vsnprintf curl_mvsnprintf
77 # define aprintf curl_maprintf
78 # define vaprintf curl_mvaprintf
79 #endif
80 
81 #ifdef  __cplusplus
82 }
83 #endif
84 
85 #endif /* __CURL_MPRINTF_H */
86