curl_mprintf.3 2.9 KB

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