diff options
Diffstat (limited to 'src/port')
-rw-r--r-- | src/port/snprintf.c | 2 | ||||
-rw-r--r-- | src/port/snprintf.h | 15 | ||||
-rw-r--r-- | src/port/stdint.h | 30 |
3 files changed, 40 insertions, 7 deletions
diff --git a/src/port/snprintf.c b/src/port/snprintf.c index 65d9602..6062154 100644 --- a/src/port/snprintf.c +++ b/src/port/snprintf.c @@ -532,7 +532,9 @@ static UINTMAX_T cast(LDOUBLE); static UINTMAX_T myround(LDOUBLE); static LDOUBLE mypow10(int); +/* not really good! extern int errno; +*/ int rpl_vsnprintf(char *str, size_t size, const char *format, va_list args) diff --git a/src/port/snprintf.h b/src/port/snprintf.h index c374a15..4e06c8b 100644 --- a/src/port/snprintf.h +++ b/src/port/snprintf.h @@ -3,13 +3,28 @@ #include "port/sys.h" +/* impose some defaults, if we need snprintf and friends on the platform + * given, we define the proper values in include/port/sys.h + */ +#ifndef HAVE_CONFIG_H #define HAVE_CONFIG_H 0 +#endif #define TEST_SNPRINTF 0 +#ifndef HAVE_STDARG_H #define HAVE_STDARG_H 1 +#endif +#ifndef HAVE_STDDEF_H #define HAVE_STDDEF_H 1 +#endif +#ifndef HAVE_SYS_TYPES_H #define HAVE_SYS_TYPES_H 1 +#endif +#ifndef HAVE_STDLIB_H #define HAVE_STDLIB_H 1 +#endif +#ifndef HAVE_VA_COPY #define HAVE_VA_COPY 1 +#endif #if HAVE_STDARG_H #include <stdarg.h> /* for va_list */ diff --git a/src/port/stdint.h b/src/port/stdint.h index 345ec7e..ec4f0ce 100644 --- a/src/port/stdint.h +++ b/src/port/stdint.h @@ -3,13 +3,29 @@ #include "port/sys.h" -#if defined HAVE_STDINT_H -#include <stdint.h> -#endif /* defined HAVE_STDINT_H */ +/* for uintptr_t and snprintf placeholder PRIdPTR (FIXME: + * needs a lot of improvement!) + */ +#if defined SUNOS + +#if OS_MAJOR_VERSION == 5 -/* Solaris 8 weirdness */ -#if defined HAVE_LINK_H -#include <link.h> -#endif /* defined HAVE_LINK_H */ +#if OS_MINOR_VERSION == 8 +#include <sys/int_types.h> +/* FIXME: this may depend on 32/64-bit version of Solaris 8! */ +#define PRIdPTR "d" +typedef unsigned long long uint64_t; +#else +#include <inttypes.h> +#include <stdint.h> +#endif /* OS_MINOR_VERSION == 8 */ +#else +#include <inttypes.h> +#include <stdint.h> +#endif /* OS_MAJOR_VERSION == 5 */ +#else +#include <inttypes.h> +#include <stdint.h> +#endif /* defined SUNOS */ #endif /* ifndef __STDINT_H */ |