diff --git a/GNUmakef.def b/GNUmakef.def index e783a17..2b4b3b4 100644 --- a/GNUmakef.def +++ b/GNUmakef.def @@ -48,6 +48,7 @@ WINDRES=windres EXEEXT=.exe OBJEXT=.o LIBEXT=.a +CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H else ifeq ($(PLATFORM),emx) CAT=cat @@ -69,6 +70,7 @@ LIBEXT=.a #OBJEXT=.obj #LIBEXT=.lib CXX=$(CC) +CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H else ifeq ($(PLATFORM),djg) CAT=command.com /c type @@ -95,6 +97,7 @@ EXEEXT= OBJEXT=.o LIBEXT=.a LNKFLAGS+=-lbe -ltextencoding +CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H else ifeq ($(PLATFORM),sun) # SUN Solaris CAT=cat @@ -108,6 +111,7 @@ EXEEXT= OBJEXT=.o LIBEXT=.a CFLAGS+=-D__SUNOS__ -D__UNIX__ -DUNIX +CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H ifeq ($(WIDE_NCURSES),1) LIBCURSES=-L/opt/csw/lib -lncursesw else @@ -131,6 +135,7 @@ LIBCURSES=-lncursesw else LIBCURSES=-lncurses endif +CFLAGS+=-DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H else # Linux, *BSD or another unix-like OS CAT=cat SED=sed @@ -155,7 +160,7 @@ endif endif endif endif -CFLAGS+=-funsigned-char -g $(INCS) -Wall -Wno-sign-compare -pedantic -O2 -DPRAGMA_PACK # -fomit-frame-pointer +CFLAGS+=-funsigned-char -g $(INCS) -Wall -Wno-sign-compare -pedantic -O2 -DPRAGMA_PACK -DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_STDARG_H # -fomit-frame-pointer LNKFLAGS+=-g CPPFLAGS+=$(CFLAGS) -fno-rtti # -fno-exceptions diff --git a/goldlib/gall/gstrall.h b/goldlib/gall/gstrall.h index 31ccff3..2af4d51 100644 --- a/goldlib/gall/gstrall.h +++ b/goldlib/gall/gstrall.h @@ -59,8 +59,10 @@ char* strlwr(char* s); // ------------------------------------------------------------------ -#if defined(_MSC_VER) +#if !defined(HAVE_SNPRINTF) int snprintf( char *buffer, size_t sizeOfBuffer, const char *format, ... ); +#endif +#if !defined(HAVE_VSNPRINTF) int vsnprintf( char *buffer, size_t sizeOfBuffer, const char *format, va_list argptr ); #endif diff --git a/goldlib/gall/gstrutil.cpp b/goldlib/gall/gstrutil.cpp index 8842f41..6dd471e 100644 --- a/goldlib/gall/gstrutil.cpp +++ b/goldlib/gall/gstrutil.cpp @@ -31,16 +31,6 @@ // ------------------------------------------------------------------- // snprintf() and vsnprintf() -// ---- FIXME: All HAVE_* macro should be defined in makefile or created by autoconf -#ifdef __GNUC__ -# define HAVE_SNPRINTF -# define HAVE_VSNPRINTF -# define HAVE_STDARG_H -#endif -#if defined(__WATCOMC__) -# define HAVE__SNPRINTF -# define HAVE__VSNPRINTF -#endif #if defined(_MSC_VER) /* It is need a workaround for implementation "speciality" in snprintf() and vsnprintf() from Microsoft. */ int snprintf( char *buffer, size_t sizeOfBuffer, const char *format, ... )