From 304b60556397464143c6fc24edb856b03fc9781a Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 28 Sep 2007 10:50:20 -0700 Subject: Add substitutes for snprintf() and vsnprintf() To deal with fools^Wpeople trying to keep really old systems alive, create a proper framework for substitution functions, and make it possible to deal with the lack of snprintf/vsnprintf in particular. --- compiler.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'compiler.h') diff --git a/compiler.h b/compiler.h index 8ceb9ee..798466f 100644 --- a/compiler.h +++ b/compiler.h @@ -38,13 +38,24 @@ #endif /* Some versions of MSVC have these only with underscores in front */ - -#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) -# define snprintf _snprintf +#include +#include +#include + +#ifndef HAVE_SNPRINTF +# ifdef HAVE__SNPRINTF +# define snprintf _snprintf +# else +int snprintf(char *, size_t, const char *, ...); +# endif #endif -#if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF) -# define vsnprintf _vsnprintf +#ifndef HAVE_VSNPRINTF +# ifdef HAVE__VSNPRINT +# define vsnprintf _vsnprintf +# else +int vsnprintf(char *, size_t, const char *, va_list); +# endif #endif #endif /* COMPILER_H */ -- cgit v1.2.3