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
strdup
strftime
vsnprintf
glob
)
CHECK_SYMBOL_EXISTS_EX("${func}")
@ -312,10 +313,10 @@ SET(NEED_STRMODE 1)
ENDIF(NOT HAVE_STRMODE)
IF(WIN32)
IF(NOT HAVE_SNPRINTF)
IF(NOT HAVE_SNPRINTF OR NOT HAVE_VSNPRINTF)
SET(libtar_SRC ${libtar_SRC} compat/snprintf.c)
SET(NEED_SNPRINTF 1)
ENDIF(NOT HAVE_SNPRINTF)
ENDIF(NOT HAVE_SNPRINTF OR NOT HAVE_VSNPRINTF)
ENDIF(WIN32)
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 */
#if !defined(HAVE_SNPRINTF)
int mutt_snprintf(char *, size_t, const char *, ...);
int mutt_vsnprintf(char *, size_t, const char *, va_list);
#define snprintf mutt_snprintf
#define vsnprintf mutt_vsnprintf
# define snprintf mutt_snprintf
#endif
#if !defined(HAVE_VSNPRINTF)
int mutt_vsnprintf(char *, size_t, const char *, va_list);
# define vsnprintf mutt_vsnprintf
#endif /* NEED_SNPRINTF && ! HAVE_SNPRINTF */
#endif

View File

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

View File

@ -51,6 +51,9 @@
/* Define if your system has a working 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. */
#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@
@ -184,7 +187,7 @@
#cmakedefine size_t @size_t@
/* 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. */
#cmakedefine uid_t @uid_t@