00001 #ifndef _PORTABLE_SNPRINTF_H_
00002 #define _PORTABLE_SNPRINTF_H_
00003
00004 #define PORTABLE_SNPRINTF_VERSION_MAJOR 2
00005 #define PORTABLE_SNPRINTF_VERSION_MINOR 2
00006
00007 #ifdef HAVE_SNPRINTF
00008 #include <stdio.h>
00009 #else
00010 extern int snprintf(char *, size_t, const char *, ...);
00011 extern int vsnprintf(char *, size_t, const char *, va_list);
00012 #endif
00013
00014
00015
00016
00017
00018
00019 #ifndef HAVE_SNPRINTF
00020 #define HAVE_SNPRINTF
00021 #endif
00022 #ifndef PREFER_PORTABLE_SNPRINTF
00023 #define PREFER_PORTABLE_SNPRINTF
00024 #endif
00025
00026 #if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF)
00027 extern int portable_snprintf(char *str, size_t str_m, const char *fmt, ...);
00028 extern int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
00029 #define snprintf portable_snprintf
00030 #define vsnprintf portable_vsnprintf
00031 #endif
00032
00033 extern int asprintf (char **ptr, const char *fmt, ...);
00034 extern int vasprintf (char **ptr, const char *fmt, va_list ap);
00035 extern int asnprintf (char **ptr, size_t str_m, const char *fmt, ...);
00036 extern int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap);
00037
00038 #endif