curl_mprintf.3 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 "30 April 2004" "libcurl 7.12" "libcurl Manual"
  23. .SH NAME
  24. curl_maprintf, curl_mfprintf, curl_mprintf, curl_msnprintf, curl_msprintf
  25. curl_mvaprintf, curl_mvfprintf, curl_mvprintf, curl_mvsnprintf,
  26. curl_mvsprintf - formatted output conversion
  27. .SH SYNOPSIS
  28. .B #include <curl/mprintf.h>
  29. .sp
  30. .BI "int curl_mprintf(const char *" format ", ...);"
  31. .br
  32. .BI "int curl_mfprintf(FILE *" fd ", const char *" format ", ...);"
  33. .br
  34. .BI "int curl_msprintf(char *" buffer ", const char *" format ", ...);"
  35. .br
  36. .BI "int curl_msnprintf(char *" buffer ", size_t " maxlength ", const char *" format ", ...);"
  37. .br
  38. .BI "int curl_mvprintf(const char *" format ", va_list " args ");"
  39. .br
  40. .BI "int curl_mvfprintf(FILE *" fd ", const char *" format ", va_list " args ");"
  41. .br
  42. .BI "int curl_mvsprintf(char *" buffer ", const char *" format ", va_list " args ");"
  43. .br
  44. .BI "int curl_mvsnprintf(char *" buffer ", size_t " maxlength ", const char *" format ", va_list " args ");"
  45. .br
  46. .BI "char *curl_maprintf(const char *" format ", ...);"
  47. .br
  48. .BI "char *curl_mvaprintf(const char *" format ", va_list " args ");"
  49. .SH DESCRIPTION
  50. These are all functions that produce output according to a format string and
  51. given arguments. These are mostly clones of the well-known C-style functions
  52. and there will be no detailed explanation of all available formatting rules
  53. and usage here.
  54. See this table for notable exceptions.
  55. .RS
  56. .TP
  57. .B curl_mprintf()
  58. Normal printf() clone.
  59. .TP
  60. .B curl_mfprintf()
  61. Normal fprintf() clone.
  62. .TP
  63. .B curl_msprintf()
  64. Normal sprintf() clone.
  65. .TP
  66. .B curl_msnprintf()
  67. snprintf() clone. Many systems don't have this. It is just like \fBsprintf\fP
  68. but with an extra argument after the buffer that specifies the length of the
  69. target buffer.
  70. .TP
  71. .B curl_mvprintf()
  72. Normal vprintf() clone.
  73. .TP
  74. .B curl_mvfprintf()
  75. Normal vfprintf() clone.
  76. .TP
  77. .B curl_mvsprintf()
  78. Normal vsprintf() clone.
  79. .TP
  80. .B curl_mvsnprintf()
  81. vsnprintf() clone. Many systems don't have this. It is just like
  82. \fBvsprintf\fP but with an extra argument after the buffer that specifies the
  83. length of the target buffer.
  84. .TP
  85. .B curl_maprintf()
  86. Like printf() but returns the output string as a malloc()ed string. The
  87. returned string must be free()ed by the receiver.
  88. .TP
  89. .B curl_mvaprintf()
  90. Like curl_maprintf() but takes a va_list pointer argument instead of a
  91. variable amount of arguments.
  92. .RE
  93. .SH AVAILABILITY
  94. These functions will be removed from the public libcurl API in the future. Do
  95. not use them in any new programs or projects.
  96. .SH RETURN VALUE
  97. The \fBcurl_maprintf\fP and \fBcurl_mvaprintf\fP functions return a pointer to
  98. a newly allocated string, or NULL if it failed.
  99. All other functions return the number of characters they actually outputted.
  100. .SH "SEE ALSO"
  101. .BR printf "(3), " sprintf "(3), " fprintf "(3), " vprintf "(3) "