From fe4e23f9ded69194d525775b1ef7648461a7f76d Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sun, 1 Nov 2009 04:01:30 +0100 Subject: Add more compat code for non GNU environments Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- include/platform.h | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'include/platform.h') diff --git a/include/platform.h b/include/platform.h index 1fa2ece2b..67b04f8cb 100644 --- a/include/platform.h +++ b/include/platform.h @@ -11,7 +11,12 @@ * true will #undef them below. */ #define HAVE_FDPRINTF 1 +#define HAVE_MEMRCHR 1 +#define HAVE_MKDTEMP 1 +#define HAVE_SETBIT 1 +#define HAVE_STRCASESTR 1 #define HAVE_STRCHRNUL 1 +#define HAVE_STRSIGNAL 1 #define HAVE_VASPRINTF 1 /* Convenience macros to test the version of gcc. */ @@ -335,17 +340,22 @@ typedef unsigned smalluint; #endif #if defined(__dietlibc__) -#undef HAVE_STRCHRNUL +# undef HAVE_STRCHRNUL #endif #if defined(__WATCOMC__) -#undef HAVE_FDPRINTF -#undef HAVE_STRCHRNUL -#undef HAVE_VASPRINTF +# undef HAVE_FDPRINTF +# undef HAVE_MEMRCHR +# undef HAVE_MKDTEMP +# undef HAVE_SETBIT +# undef HAVE_STRCASESTR +# undef HAVE_STRCHRNUL +# undef HAVE_STRSIGNAL +# undef HAVE_VASPRINTF #endif #if defined(__FreeBSD__) -#undef HAVE_STRCHRNUL +# undef HAVE_STRCHRNUL #endif /* @@ -353,16 +363,38 @@ typedef unsigned smalluint; * These must come after all the HAVE_* macros are defined (or not) */ +#ifndef HAVE_FDPRINTF +extern int fdprintf(int fd, const char *format, ...); +#endif + +#ifndef HAVE_MEMRCHR +extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; +#endif + +#ifndef HAVE_MKDTEMP +extern char *mkdtemp(char *template) FAST_FUNC; +#endif + +#ifndef HAVE_SETBIT +# define setbit(a, b) ((a)[(b) >> 3] |= 1 << ((b) & 7)) +# define clrbit(a, b) ((a)[(b) >> 3] &= ~(1 << ((b) & 7))) +#endif + +#ifndef HAVE_STRCASESTR +extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC; +#endif + #ifndef HAVE_STRCHRNUL extern char *strchrnul(const char *s, int c) FAST_FUNC; #endif -#ifndef HAVE_VASPRINTF -extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; +#ifndef HAVE_STRSIGNAL +/* Not exactly the same: instead of "Stopped" it shows "STOP" etc */ +# define strsignal(sig) get_signame(sig) #endif -#ifndef HAVE_FDPRINTF -extern int fdprintf(int fd, const char *format, ...); +#ifndef HAVE_VASPRINTF +extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; #endif #endif -- cgit v1.2.3