snprintf.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * snprintf.h
  3. * header file for snprintf.c
  4. *
  5. */
  6. #ifndef _EGG_COMPAT_SNPRINTF_H_
  7. #define _EGG_COMPAT_SNPRINTF_H_
  8. #ifdef HAVE_CONFIG_H
  9. # include "config.h"
  10. #endif
  11. #include <stdio.h>
  12. /* Check for broken snprintf versions */
  13. #ifdef BROKEN_SNPRINTF
  14. # ifdef HAVE_VSNPRINTF
  15. # undef HAVE_VSNPRINTF
  16. # endif
  17. # ifdef HAVE_SNPRINTF
  18. # undef HAVE_SNPRINTF
  19. # endif
  20. #endif
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Use the system libraries version of vsnprintf() if available. Otherwise
  25. * use our own.
  26. */
  27. #ifndef HAVE_VSNPRINTF
  28. int egg_vsnprintf(char *, size_t, const char *, va_list) __attribute__((format(printf, 3, 0)));
  29. #else
  30. # define egg_vsnprintf vsnprintf
  31. #endif
  32. /* Use the system libraries version of snprintf() if available. Otherwise
  33. * use our own.
  34. */
  35. #ifndef HAVE_SNPRINTF
  36. # ifdef __STDC__
  37. int egg_snprintf(char *, size_t, const char *, ...) __attribute__((format(printf, 3, 4)));
  38. # else
  39. int egg_snprintf();
  40. # endif
  41. #else
  42. # define egg_snprintf snprintf
  43. #endif
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif /* !_EGG_COMPAT_SNPRINTF_H_ */