Imported Upstream version 7.59.0
[platform/upstream/curl.git] / docs / libcurl / curl_mprintf.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" **************************************************************************
22 .TH curl_printf 3 "April 01, 2016" "libcurl 7.59.0" "libcurl Manual"
23
24 .SH NAME
25 curl_maprintf, curl_mfprintf, curl_mprintf, curl_msnprintf, curl_msprintf
26 curl_mvaprintf, curl_mvfprintf, curl_mvprintf, curl_mvsnprintf,
27 curl_mvsprintf - formatted output conversion
28 .SH SYNOPSIS
29 .B #include <curl/mprintf.h>
30 .sp
31 .BI "int curl_mprintf(const char *" format ", ...);"
32 .br
33 .BI "int curl_mfprintf(FILE *" fd ", const char *" format ", ...);"
34 .br
35 .BI "int curl_msprintf(char *" buffer ", const char *" format ", ...);"
36 .br
37 .BI "int curl_msnprintf(char *" buffer ", size_t " maxlength ", const char *" format ", ...);"
38 .br
39 .BI "int curl_mvprintf(const char *" format ", va_list " args ");"
40 .br
41 .BI "int curl_mvfprintf(FILE *" fd ", const char *" format ", va_list " args ");"
42 .br
43 .BI "int curl_mvsprintf(char *" buffer ", const char *" format ", va_list " args ");"
44 .br
45 .BI "int curl_mvsnprintf(char *" buffer ", size_t " maxlength ", const char *" format ", va_list " args ");"
46 .br
47 .BI "char *curl_maprintf(const char *" format ", ...);"
48 .br
49 .BI "char *curl_mvaprintf(const char *" format ", va_list " args ");"
50 .SH DESCRIPTION
51 These are all functions that produce output according to a format string and
52 given arguments. These are mostly clones of the well-known C-style functions
53 and there will be no detailed explanation of all available formatting rules
54 and usage here.
55
56 See this table for notable exceptions.
57 .RS
58 .TP
59 .B curl_mprintf()
60 Normal printf() clone.
61 .TP
62 .B curl_mfprintf()
63 Normal fprintf() clone.
64 .TP
65 .B curl_msprintf()
66 Normal sprintf() clone.
67 .TP
68 .B curl_msnprintf()
69 snprintf() clone. Many systems don't have this. It is just like \fBsprintf\fP
70 but with an extra argument after the buffer that specifies the length of the
71 target buffer.
72 .TP
73 .B curl_mvprintf()
74 Normal vprintf() clone.
75 .TP
76 .B curl_mvfprintf()
77 Normal vfprintf() clone.
78 .TP
79 .B curl_mvsprintf()
80 Normal vsprintf() clone.
81 .TP
82 .B curl_mvsnprintf()
83 vsnprintf() clone.  Many systems don't have this. It is just like
84 \fBvsprintf\fP but with an extra argument after the buffer that specifies the
85 length of the target buffer.
86 .TP
87 .B curl_maprintf()
88 Like printf() but returns the output string as a malloc()ed string. The
89 returned string must be free()ed by the receiver.
90 .TP
91 .B curl_mvaprintf()
92 Like curl_maprintf() but takes a va_list pointer argument instead of a
93 variable amount of arguments.
94 .RE
95 .SH AVAILABILITY
96 These functions will be removed from the public libcurl API in the future. Do
97 not use them in any new programs or projects.
98 .SH RETURN VALUE
99 The \fBcurl_maprintf\fP and \fBcurl_mvaprintf\fP functions return a pointer to
100 a newly allocated string, or NULL if it failed.
101
102 All other functions return the number of characters they actually outputted.
103 .SH "SEE ALSO"
104 .BR printf "(3), " sprintf "(3), " fprintf "(3), " vprintf "(3) "