diff options
Diffstat (limited to 'src/port/snprintf.h')
-rw-r--r-- | src/port/snprintf.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/port/snprintf.h b/src/port/snprintf.h new file mode 100644 index 0000000..158e5fb --- /dev/null +++ b/src/port/snprintf.h @@ -0,0 +1,59 @@ +#ifndef __SNPRINTF_H +#define __SNPRINTF_H + +#include "sys.h" + +#define HAVE_CONFIG_H 0 +#define TEST_SNPRINTF 0 +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_VA_COPY 1 + +#if HAVE_STDARG_H +#include <stdarg.h> /* for va_list */ +#endif + +#if HAVE_SYS_TYPES_H +#include <sys/types.h> /* for size_t */ +#endif + +#if !defined HAVE_VSNPRINTF +#define vsnprintf rpl_vsnprintf +#if HAVE_STDARG_H +extern int rpl_vsnprintf(char *str, size_t size, const char *format, va_list args); +#else + #error va_list required for vsnprintf! +#endif /* HAVE_STDARG_H */ +#endif /* !defined HAVE_VSNPRINTF */ + +#if !defined HAVE_SNPRINTF +#define snprintf rpl_snprintf +#if HAVE_STDARG_H +extern int +rpl_snprintf(char *str, size_t size, const char *format, ...); +#else +extern int +rpl_snprintf(va_alist) va_dcl; +#endif /* HAVE_STDARG_H */ +#endif /* ! defined HAVE_SNPRINTF */ + +#if !defined HAVE_VASPRINTF +#define vasprintf rpl_vasprintf +extern int +rpl_vasprintf(char **ret, const char *format, va_list ap); +#endif /* ! defined HAVE_VASPRINTF */ + +#if !defined HAVE_ASPRINTF +#define asprintf rpl_asprintf +#if HAVE_STDARG_H +extern int +rpl_asprintf(char **ret, const char *format, ...); +#else +extern int +rpl_asprintf(va_alist) va_dcl; +#endif /* HAVE_STDARG_H */ +#endif /* ! defined HAVE_ASPRINTF */ + +#endif /* ifndef __SNPRINTF_H */ |