Commit f1552ed8 authored by Niels Möller's avatar Niels Möller

* vsnprintf.c (dopr): Fixed va_arg calls that used short. Made

inclusion of "config.h" conditional on HAVE_CONFIG_H.

* configure.ac: Check for snprintf, vsnprintf and stdarg.h.

* Makefile.am (EXTRA_DIST): Added vsnprintf.c. Renabled building
of argp-test.

Rev: src/argp/ChangeLog:1.27
Rev: src/argp/Makefile.am:1.12
Rev: src/argp/configure.ac:1.17
Rev: src/argp/vsnprintf.c:1.2
parent a2de2827
2004-03-05 Niels Mller <nisse@lysator.liu.se>
* vsnprintf.c (dopr): Fixed va_arg calls that used short. Made
inclusion of "config.h" conditional on HAVE_CONFIG_H.
* configure.ac: Check for snprintf, vsnprintf and stdarg.h.
* Makefile.am (EXTRA_DIST): Added vsnprintf.c. Renabled building
of argp-test.
* vsnprintf.c: New replacement vsnprintf, by Patrick Powell,
Brandom Long and others.
......
......@@ -24,10 +24,10 @@ SUBDIRS = . testsuite
LIBOBJS = @LIBOBJS@
noinst_LIBRARIES = libargp.a
EXTRA_PROGRAMS = argp-test
noinst_PROGRAMS = argp-test
noinst_HEADERS = argp.h argp-fmtstream.h argp-namefrob.h
EXTRA_DIST = mempcpy.c strchrnul.c strndup.c strcasecmp.c Versions
EXTRA_DIST = mempcpy.c strchrnul.c strndup.c strcasecmp.c vsnprintf.c Versions
# Leaves out argp-fs-xinl.c and argp-xinl.c
libargp_a_SOURCES = argp-ba.c argp-eexst.c argp-fmtstream.c \
......
......@@ -26,7 +26,7 @@ fi
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h malloc.h unistd.h sysexits.h)
AC_CHECK_HEADERS(limits.h malloc.h unistd.h sysexits.h stdarg.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
......@@ -40,7 +40,7 @@ AC_FUNC_ALLOCA
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strerror sleep getpid)
AC_REPLACE_FUNCS(mempcpy strndup strchrnul strcasecmp)
AC_REPLACE_FUNCS(mempcpy strndup strchrnul strcasecmp snprintf vsnprintf)
dnl ARGP_CHECK_FUNC(includes, function-call [, if-found [, if-not-found]])
AC_DEFUN([ARGP_CHECK_FUNC],
......
......@@ -55,7 +55,9 @@
*
**************************************************************/
#include "config.h"
#if HAVE_CONFIG_H
# include "config.h"
#endif
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
......@@ -271,7 +273,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 'd':
case 'i':
if (cflags == DP_C_SHORT)
value = va_arg (args, short int);
value = (short) va_arg (args, int);
else if (cflags == DP_C_LONG)
value = va_arg (args, long int);
else
......@@ -281,7 +283,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 'o':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
value = va_arg (args, unsigned short int);
value = (unsigned short) va_arg (args, unsigned);
else if (cflags == DP_C_LONG)
value = va_arg (args, unsigned long int);
else
......@@ -291,7 +293,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 'u':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
value = va_arg (args, unsigned short int);
value = (unsigned short) va_arg (args, unsigned);
else if (cflags == DP_C_LONG)
value = va_arg (args, unsigned long int);
else
......@@ -303,7 +305,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 'x':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
value = va_arg (args, unsigned short int);
value = (unsigned short) va_arg (args, unsigned);
else if (cflags == DP_C_LONG)
value = va_arg (args, unsigned long int);
else
......
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