1 #ifndef _PORTABLE_SNPRINTF_H_ 2 #define _PORTABLE_SNPRINTF_H_ 3 4 #ifdef HAVE_CONFIG_H 5 #include <config.h> 6 #endif 7 8 #define PORTABLE_SNPRINTF_VERSION_MAJOR 2 9 #define PORTABLE_SNPRINTF_VERSION_MINOR 2 10 11 #ifdef HAVE_SNPRINTF 12 #include <stdio.h> 13 #else 14 extern int snprintf(char *, size_t, const char *, /*args*/ ...); 15 extern int vsnprintf(char *, size_t, const char *, va_list); 16 #endif 17 18 #if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF) 19 extern int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...); 20 extern int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap); 21 #define snprintf portable_snprintf 22 #define vsnprintf portable_vsnprintf 23 #endif 24 25 extern int asprintf (char **ptr, const char *fmt, /*args*/ ...); 26 extern int vasprintf (char **ptr, const char *fmt, va_list ap); 27 extern int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...); 28 extern int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap); 29 30 #endif 31