2
0

curl_mprintf.3 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. .\" $Id$
  2. .\"
  3. .TH curl_printf 3 "30 April 2004" "libcurl 7.12" "libcurl Manual"
  4. .SH NAME
  5. curl_maprintf, curl_mfprintf, curl_mprintf, curl_msnprintf, curl_msprintf
  6. curl_mvaprintf, curl_mvfprintf, curl_mvprintf, curl_mvsnprintf,
  7. curl_mvsprintf - formatted output conversion
  8. .SH SYNOPSIS
  9. .B #include <curl/mprintf.h>
  10. .sp
  11. .BI "int curl_mprintf(const char *" format ", ...);"
  12. .br
  13. .BI "int curl_mfprintf(FILE *" fd ", const char *" format ", ...);"
  14. .br
  15. .BI "int curl_msprintf(char *" buffer ", const char *" format ", ...);"
  16. .br
  17. .BI "int curl_msnprintf(char *" buffer ", size_t " maxlength ", const char *" format ", ...);"
  18. .br
  19. .BI "int curl_mvprintf(const char *" format ", va_list " args ");"
  20. .br
  21. .BI "int curl_mvfprintf(FILE *" fd ", const char *" format ", va_list " args ");"
  22. .br
  23. .BI "int curl_mvsprintf(char *" buffer ", const char *" format ", va_list " args ");"
  24. .br
  25. .BI "int curl_mvsnprintf(char *" buffer ", size_t " maxlength ", const char *" format ", va_list " args ");"
  26. .br
  27. .BI "char *curl_maprintf(const char *" format ", ...);"
  28. .br
  29. .BI "char *curl_mvaprintf(const char *" format ", va_list " args ");"
  30. .SH DESCRIPTION
  31. These are all functions that produce output according to a format string and
  32. given arguments. These are mostly clones of the well-known C-style functions
  33. and there will be no detailed explanation of all available formatting rules
  34. and usage here.
  35. See this table for notable exceptions.
  36. .RS
  37. .TP
  38. .B curl_mprintf()
  39. Normal printf() clone.
  40. .TP
  41. .B curl_mfprintf()
  42. Normal fprintf() clone.
  43. .TP
  44. .B curl_msprintf()
  45. Normal sprintf() clone.
  46. .TP
  47. .B curl_msnprintf()
  48. snprintf() clone. Many systems don't have this. It is just like \fBsprintf\fP
  49. but with an extra argument after the buffer that specifies the length of the
  50. target buffer.
  51. .TP
  52. .B curl_mvprintf()
  53. Normal vprintf() clone.
  54. .TP
  55. .B curl_mvfprintf()
  56. Normal vfprintf() clone.
  57. .TP
  58. .B curl_mvsprintf()
  59. Normal vsprintf() clone.
  60. .TP
  61. .B curl_mvsnprintf()
  62. vsnprintf() clone. Many systems don't have this. It is just like
  63. \fBvsprintf\fP but with an extra argument after the buffer that specifies the
  64. length of the target buffer.
  65. .TP
  66. .B curl_maprintf()
  67. Like printf() but returns the output string as a malloc()ed string. The
  68. returned string must be free()ed by the receiver.
  69. .TP
  70. .B curl_mvaprintf()
  71. Like curl_maprintf() but takes a va_list pointer argument instead of a
  72. variable amount of arguments.
  73. .RE
  74. To easily use all these cloned functions instead of the normal ones, #define
  75. _MPRINTF_REPLACE before you include the <curl/mprintf.h> file. Then all the
  76. normal names like printf, fprintf, sprintf etc will use the curl-functions
  77. instead.
  78. .SH AVAILABILITY
  79. These function will be removed from the public libcurl API in a near
  80. future. They will instead be made "available" by source code access only, and
  81. then as curlx_-prefixed functions. See lib/README.curlx for further details.
  82. .SH RETURN VALUE
  83. The \fBcurl_maprintf\fP and \fBcurl_mvaprintf\fP functions return a pointer to
  84. a newly allocated string, or NULL if it failed.
  85. All other functions return the number of characters they actually outputted.
  86. .SH "SEE ALSO"
  87. .BR printf "(3), " sprintf "(3), " fprintf "(3), " vprintf "(3) "