snprintf.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Wrapper around https://github.com/weiss/c99-snprintf
  3. */
  4. #define HAVE_CONFIG_H 0
  5. #define TEST_SNPRINTF 0
  6. #define HAVE_SNPRINTF 0
  7. #define HAVE_VSNPRINTF 0
  8. #define HAVE_ASPRINTF 0
  9. #define HAVE_VASPRINTF 0
  10. #define HAVE_STDARG_H 1
  11. #define HAVE_STDLIB_H 1
  12. #define HAVE_VA_COPY 0
  13. #define HAVE___VA_COPY 0
  14. #define HAVE_FLOAT_H 1
  15. #define HAVE_INTTYPES_H 1
  16. #define HAVE_LOCALE_H 0
  17. #define HAVE_STDDEF_H 1
  18. #define HAVE_STDINT_H 1
  19. #define HAVE_UNSIGNED_LONG_LONG_INT 1
  20. #define HAVE_UINTMAX_T 1
  21. #define HAVE_LONG_DOUBLE 0
  22. #define HAVE_LONG_LONG_INT 1
  23. #define HAVE_INTMAX_T 1
  24. #define HAVE_UINTPTR_T 1
  25. #define HAVE_PTRDIFF_T 1
  26. #define HAVE_LOCALECONV 0
  27. #define HAVE_LCONV_DECIMAL_POINT 0
  28. #define HAVE_LCONV_THOUSANDS_SEP 0
  29. #define LDOUBLE_MIN_10_EXP DBL_MIN_10_EXP
  30. #define LDOUBLE_MAX_10_EXP DBL_MAX_10_EXP
  31. #define rpl_snprintf snprintf
  32. #define rpl_vsnprintf vsnprintf
  33. #define rpl_vasprintf vasprintf
  34. #define rpl_asprintf asprintf
  35. #include "c99-snprintf/snprintf.c"
  36. int sprintf(char *s, const char *fmt, ...)
  37. {
  38. int n;
  39. va_list arg;
  40. va_start(arg, fmt);
  41. n = vsnprintf(s, 1024, fmt, arg);
  42. va_end(arg);
  43. return n;
  44. }
  45. int vsprintf (char *d, const char *s, va_list ap)
  46. {
  47. return vsnprintf(d, 1024, s, ap);
  48. }