COMP: Fix support for vsnprintf

This commit is contained in:
Andy Cedilnik 2005-12-30 17:27:57 -05:00
parent 6534e66e61
commit c09548b50e
4 changed files with 14 additions and 7 deletions

View File

@ -97,6 +97,7 @@ FOREACH(func
strsep strsep
strdup strdup
strftime strftime
vsnprintf
glob glob
) )
CHECK_SYMBOL_EXISTS_EX("${func}") CHECK_SYMBOL_EXISTS_EX("${func}")
@ -312,10 +313,10 @@ SET(NEED_STRMODE 1)
ENDIF(NOT HAVE_STRMODE) ENDIF(NOT HAVE_STRMODE)
IF(WIN32) IF(WIN32)
IF(NOT HAVE_SNPRINTF) IF(NOT HAVE_SNPRINTF OR NOT HAVE_VSNPRINTF)
SET(libtar_SRC ${libtar_SRC} compat/snprintf.c) SET(libtar_SRC ${libtar_SRC} compat/snprintf.c)
SET(NEED_SNPRINTF 1) SET(NEED_SNPRINTF 1)
ENDIF(NOT HAVE_SNPRINTF) ENDIF(NOT HAVE_SNPRINTF OR NOT HAVE_VSNPRINTF)
ENDIF(WIN32) ENDIF(WIN32)
IF(NOT HAVE_DIRNAME) IF(NOT HAVE_DIRNAME)

View File

@ -201,10 +201,12 @@ int inet_aton(const char *, struct in_addr *);
#ifdef _MSC_VER /* compile snprintf only onwin32 */ #ifdef _MSC_VER /* compile snprintf only onwin32 */
#if !defined(HAVE_SNPRINTF) #if !defined(HAVE_SNPRINTF)
int mutt_snprintf(char *, size_t, const char *, ...); int mutt_snprintf(char *, size_t, const char *, ...);
int mutt_vsnprintf(char *, size_t, const char *, va_list); # define snprintf mutt_snprintf
#define snprintf mutt_snprintf #endif
#define vsnprintf mutt_vsnprintf
#if !defined(HAVE_VSNPRINTF)
int mutt_vsnprintf(char *, size_t, const char *, va_list);
# define vsnprintf mutt_vsnprintf
#endif /* NEED_SNPRINTF && ! HAVE_SNPRINTF */ #endif /* NEED_SNPRINTF && ! HAVE_SNPRINTF */
#endif #endif

View File

@ -44,6 +44,7 @@
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <stdio.h>
#include <string.h> #include <string.h>
# include <ctype.h> # include <ctype.h>
#include <sys/types.h> #include <sys/types.h>
@ -706,7 +707,7 @@ int mutt_snprintf (va_alist) va_dcl
VA_SHIFT (str, char *); VA_SHIFT (str, char *);
VA_SHIFT (count, size_t ); VA_SHIFT (count, size_t );
VA_SHIFT (fmt, char *); VA_SHIFT (fmt, char *);
(void) mutt_vsnprintf(str, count, fmt, ap); (void) vsnprintf(str, count, fmt, ap);
VA_END; VA_END;
return(strlen(str)); return(strlen(str));
} }

View File

@ -51,6 +51,9 @@
/* Define if your system has a working snprintf */ /* Define if your system has a working snprintf */
#cmakedefine HAVE_SNPRINTF @HAVE_SNPRINTF@ #cmakedefine HAVE_SNPRINTF @HAVE_SNPRINTF@
/* Define if your system has a working vsnprintf */
#cmakedefine HAVE_VSNPRINTF @HAVE_VSNPRINTF@
/* Define to 1 if you have the <stdint.h> header file. */ /* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@ #cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@
@ -184,7 +187,7 @@
#cmakedefine size_t @size_t@ #cmakedefine size_t @size_t@
/* Define to `int' if <sys/types.h> does not define. */ /* Define to `int' if <sys/types.h> does not define. */
#cmakedefine ssize_t @size_t@ #cmakedefine ssize_t @ssize_t@
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#cmakedefine uid_t @uid_t@ #cmakedefine uid_t @uid_t@