Commit 7fab6082 authored by Tom Lane's avatar Tom Lane

Add configure test to see whether vsnprintf() is present,

separately from snprintf() --- HPUX, for one, has snprintf but not
vsnprintf.  Fix a minor typo in snprintf.c, too.
parent cd6bc85a
......@@ -73,7 +73,7 @@ typedef unsigned long long ulong_long;
* causing nast effects.
**************************************************************/
/*static char _id[] = "$Id: snprintf.c,v 1.15 1998/12/24 05:28:50 momjian Exp $";*/
/*static char _id[] = "$Id: snprintf.c,v 1.16 1999/01/17 03:22:49 tgl Exp $";*/
static char *end;
static int SnprfOverflow;
......@@ -115,7 +115,7 @@ vsnprintf(char *str, size_t count, const char *fmt, va_list args)
static void fmtstr __P((char *value, int ljust, int len, int zpad, int maxwidth));
#ifndef HAVE_LONG_INT_64
#ifndef HAVE_LONG_LONG_INT_64
static void fmtnum __P((long value, int base, int dosign, int ljust, int len, int zpad));
#else
static void fmtnum __P((long_long value, int base, int dosign, int ljust, int len, int zpad));
......
This diff is collapsed.
......@@ -695,9 +695,14 @@ AC_FUNC_VPRINTF
AC_CHECK_FUNCS(tzset memmove sigsetjmp kill sysconf fpclass)
AC_CHECK_FUNCS(fp_class fp_class_d class)
AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt)
dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
dnl is missing. Yes, there are machines that have only one.
AC_CHECK_FUNC(snprintf,
AC_DEFINE(HAVE_SNPRINTF),
SNPRINTF='snprintf.o')
AC_CHECK_FUNC(vsnprintf,
AC_DEFINE(HAVE_VSNPRINTF),
SNPRINTF='snprintf.o')
AC_SUBST(SNPRINTF)
AC_CHECK_FUNC(isinf,
AC_DEFINE(HAVE_ISINF),
......
......@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.47 1998/12/13 03:44:38 momjian Exp $
* $Id: c.h,v 1.48 1999/01/17 03:22:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -45,9 +45,13 @@
/* We have to include stdlib.h here because it defines many of these macros
on some platforms, and we only want our definitions used if stdlib.h doesn't
have its own.
have its own. The same goes for stddef and stdarg if present.
*/
#include <stdlib.h>
#ifdef STDC_HEADERS
#include <stddef.h>
#include <stdarg.h>
#endif
/* ----------------------------------------------------------------
* Section 1: bool, true, false, TRUE, FALSE
......@@ -820,6 +824,19 @@ extern char *form(const char *fmt,...);
#define COPY_CMD "cp"
#define SEP_CHAR '/'
/* Provide prototypes for routines not present in a particular machine's
* standard C library. It'd be better to put these in config.h, but
* in config.h we haven't yet included anything that defines size_t...
*/
#ifndef HAVE_SNPRINTF
extern int snprintf(char *str, size_t count, const char *fmt, ...);
#endif
#ifndef HAVE_VSNPRINTF
extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
#endif
/* ----------------
* end of c.h
* ----------------
......
......@@ -118,6 +118,9 @@
/* Set to 1 if you have snprintf() */
#undef HAVE_SNPRINTF
/* Set to 1 if you have vsnprintf() */
#undef HAVE_VSNPRINTF
/* Set to 1 if you have fp_class() */
#undef HAVE_FP_CLASS
......
......@@ -6,6 +6,14 @@ typedef struct
int sema[4];
} slock_t;
/* HPUX 9 has snprintf in the library, so configure will set HAVE_SNPRINTF;
* but it doesn't provide a prototype for it. To suppress warning messages
* from gcc, do this to make c.h provide the prototype:
*/
#ifndef HAVE_VSNPRINTF
#undef HAVE_SNPRINTF
#endif
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment