Imported Upstream version 7.53.1
[platform/upstream/curl.git] / lib / curlx.h
1 #ifndef HEADER_CURL_CURLX_H
2 #define HEADER_CURL_CURLX_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2016, 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 https://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies 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 /*
26  * Defines protos and includes all header files that provide the curlx_*
27  * functions. The curlx_* functions are not part of the libcurl API, but are
28  * stand-alone functions whose sources can be built and linked by apps if need
29  * be.
30  */
31
32 #include <curl/mprintf.h>
33 /* this is still a public header file that provides the curl_mprintf()
34    functions while they still are offered publicly. They will be made library-
35    private one day */
36
37 #include "strcase.h"
38 /* "strcase.h" provides the strcasecompare protos */
39
40 #include "strtoofft.h"
41 /* "strtoofft.h" provides this function: curlx_strtoofft(), returns a
42    curl_off_t number from a given string.
43 */
44
45 #include "timeval.h"
46 /*
47   "timeval.h" sets up a 'struct timeval' even for platforms that otherwise
48   don't have one and has protos for these functions:
49
50   curlx_tvnow()
51   curlx_tvdiff()
52   curlx_tvdiff_secs()
53 */
54
55 #include "nonblock.h"
56 /* "nonblock.h" provides curlx_nonblock() */
57
58 #include "warnless.h"
59 /* "warnless.h" provides functions:
60
61   curlx_ultous()
62   curlx_ultouc()
63   curlx_uztosi()
64 */
65
66 /* Now setup curlx_ * names for the functions that are to become curlx_ and
67    be removed from a future libcurl official API:
68    curlx_getenv
69    curlx_mprintf (and its variations)
70    curlx_strcasecompare
71    curlx_strncasecompare
72
73 */
74
75 #define curlx_getenv curl_getenv
76 #define curlx_mvsnprintf curl_mvsnprintf
77 #define curlx_msnprintf curl_msnprintf
78 #define curlx_maprintf curl_maprintf
79 #define curlx_mvaprintf curl_mvaprintf
80 #define curlx_msprintf curl_msprintf
81 #define curlx_mprintf curl_mprintf
82 #define curlx_mfprintf curl_mfprintf
83 #define curlx_mvsprintf curl_mvsprintf
84 #define curlx_mvprintf curl_mvprintf
85 #define curlx_mvfprintf curl_mvfprintf
86
87 #ifdef ENABLE_CURLX_PRINTF
88 /* If this define is set, we define all "standard" printf() functions to use
89    the curlx_* version instead. It makes the source code transparent and
90    easier to understand/patch. Undefine them first. */
91 # undef printf
92 # undef fprintf
93 # undef sprintf
94 # undef snprintf
95 # undef vprintf
96 # undef vfprintf
97 # undef vsprintf
98 # undef vsnprintf
99 # undef aprintf
100 # undef vaprintf
101
102 # define printf curlx_mprintf
103 # define fprintf curlx_mfprintf
104 # define sprintf curlx_msprintf
105 # define snprintf curlx_msnprintf
106 # define vprintf curlx_mvprintf
107 # define vfprintf curlx_mvfprintf
108 # define vsprintf curlx_mvsprintf
109 # define vsnprintf curlx_mvsnprintf
110 # define aprintf curlx_maprintf
111 # define vaprintf curlx_mvaprintf
112 #endif /* ENABLE_CURLX_PRINTF */
113
114 #endif /* HEADER_CURL_CURLX_H */
115