mprintf.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*************************************************************************
  2. *
  3. * $Id$
  4. *
  5. * Permission to use, copy, modify, and distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  10. * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  11. * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
  12. * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
  13. *
  14. *************************************************************************
  15. *
  16. * Preliminary documentation
  17. *
  18. * printf conversions:
  19. *
  20. * conversion ::= '%%' | '%' [position] ( number | float | string )
  21. * position ::= digits '$'
  22. * number ::= [number-flags] ( 'd' | 'i' | 'o' | 'x' | 'X' | 'u')
  23. * number-flags ::= 'h' | 'l' | 'L' ...
  24. * float ::= [float-flags] ( 'f' | 'e' | 'E' | 'g' | 'G' )
  25. * string ::= [string-flags] 's'
  26. * string-flags ::= padding | '#'
  27. * digits ::= (digit)+
  28. * digit ::= 0-9
  29. *
  30. * c
  31. * p
  32. * n
  33. *
  34. * qualifiers
  35. *
  36. * - : left adjustment
  37. * + : show sign
  38. * SPACE : padding
  39. * # : alterative
  40. * . : precision
  41. * * : width
  42. * 0 : padding / size
  43. * 1-9 : size
  44. * h : short
  45. * l : long
  46. * ll : longlong
  47. * L : long double
  48. * Z : long / longlong
  49. * q : longlong
  50. *
  51. ************************************************************************/
  52. #ifndef H_MPRINTF
  53. #define H_MPRINTF
  54. #include <stdarg.h>
  55. #include <stdio.h> /* needed for FILE */
  56. int curl_mprintf(const char *format, ...);
  57. int curl_mfprintf(FILE *fd, const char *format, ...);
  58. int curl_msprintf(char *buffer, const char *format, ...);
  59. int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
  60. int curl_mvprintf(const char *format, va_list args);
  61. int curl_mvfprintf(FILE *fd, const char *format, va_list args);
  62. int curl_mvsprintf(char *buffer, const char *format, va_list args);
  63. int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
  64. char *curl_maprintf(const char *format, ...);
  65. char *curl_mvaprintf(const char *format, va_list args);
  66. #ifdef _MPRINTF_REPLACE
  67. # define printf curl_mprintf
  68. # define fprintf curl_mfprintf
  69. # define sprintf curl_msprintf
  70. # define snprintf curl_msnprintf
  71. # define vprintf curl_mvprintf
  72. # define vfprintf curl_mvfprintf
  73. # define vsprintf curl_mvsprintf
  74. # define vsnprintf curl_mvsnprintf
  75. # define aprintf curl_maprintf
  76. # define vaprintf curl_mvaprintf
  77. #endif
  78. #endif /* H_MPRINTF */