Commit f9523183 authored by Mark Andrews's avatar Mark Andrews

1475. [port] Probe for old sprintf().

parent 090f79c6
1475. [port] Probe for old sprintf().
1474. [port] Provide strtoul() and memmove() for platforms
without them.
......
#! /bin/sh
# From configure.in Revision: 1.343 .
# From configure.in Revision: 1.344 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53.
#
......@@ -13306,6 +13306,56 @@ fi
ISC_PRINT_OBJS=
ISC_PRINT_SRCS=
echo "$as_me:$LINENO: checking sprintf" >&5
echo $ECHO_N "checking sprintf... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <stdio.h>
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
char buf[2]; return(*sprintf(buf,"x"));
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
fi
rm -f conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: checking for vsnprintf" >&5
echo $ECHO_N "checking for vsnprintf... $ECHO_C" >&6
if test "${ac_cv_func_vsnprintf+set}" = set; then
......@@ -13391,12 +13441,14 @@ echo "${ECHO_T}$ac_cv_func_vsnprintf" >&6
if test $ac_cv_func_vsnprintf = yes; then
ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
else
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS print.$O"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS print.c"
ISC_EXTRA_OBJS="print.$O"
ISC_EXTRA_SRCS="print.c"
ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
fi
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
echo "$as_me:$LINENO: checking for strerror" >&5
echo $ECHO_N "checking for strerror... $ECHO_C" >&6
......@@ -15590,6 +15642,7 @@ s,@ISC_PLATFORM_NEEDMEMMOVE@,$ISC_PLATFORM_NEEDMEMMOVE,;t t
s,@ISC_PLATFORM_NEEDSTRTOUL@,$ISC_PLATFORM_NEEDSTRTOUL,;t t
s,@ISC_PLATFORM_NEEDSTRLCPY@,$ISC_PLATFORM_NEEDSTRLCPY,;t t
s,@ISC_PLATFORM_NEEDSTRLCAT@,$ISC_PLATFORM_NEEDSTRLCAT,;t t
s,@ISC_PLATFORM_NEEDSPRINTF@,$ISC_PLATFORM_NEEDSPRINTF,;t t
s,@ISC_PLATFORM_NEEDVSNPRINTF@,$ISC_PLATFORM_NEEDVSNPRINTF,;t t
s,@ISC_EXTRA_OBJS@,$ISC_EXTRA_OBJS,;t t
s,@ISC_EXTRA_SRCS@,$ISC_EXTRA_SRCS,;t t
......
......@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.343 $)
AC_REVISION($Revision: 1.344 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13)
......@@ -1595,12 +1595,30 @@ AC_CHECK_FUNC(strlcat,
[ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"])
AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT)
ISC_PRINT_OBJS=
ISC_PRINT_SRCS=
AC_MSG_CHECKING(sprintf)
AC_TRY_COMPILE([
#include <stdio.h>
],
[ char buf[2]; return(*sprintf(buf,"x"));],
[
ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
],
[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"]
)
AC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
AC_CHECK_FUNC(vsnprintf,
[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"],
[ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS print.$O"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS print.c"
[ISC_EXTRA_OBJS="print.$O"
ISC_EXTRA_SRCS="print.c"
ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"])
AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR))
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: platform.h.in,v 1.32 2003/06/24 05:10:33 marka Exp $ */
/* $Id: platform.h.in,v 1.33 2003/06/24 06:23:59 marka Exp $ */
#ifndef ISC_PLATFORM_H
#define ISC_PLATFORM_H 1
......@@ -143,6 +143,11 @@
*/
@ISC_PLATFORM_NEEDVSNPRINTF@
/*
* If this system need a modern sprintf() that returns (int) not (char*).
*/
@ISC_PLATFORM_NEEDSPRINTF@
/*
* The printf format string modifier to use with isc_uint64_t values.
*/
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: print.h,v 1.17 2001/02/27 02:19:33 gson Exp $ */
/* $Id: print.h,v 1.18 2003/06/24 06:23:59 marka Exp $ */
#ifndef ISC_PRINT_H
#define ISC_PRINT_H 1
......@@ -38,6 +38,10 @@
#define ISC_PLATFORM_NEEDVSNPRINTF
#endif
#if !defined(ISC_PLATFORM_NEEDSPRINTF) && defined(ISC__PRINT_SOURCE)
#define ISC_PLATFORM_NEEDSPRINTF
#endif
/***
*** Macros
***/
......@@ -50,9 +54,11 @@
#ifdef ISC_PLATFORM_NEEDVSNPRINTF
#include <stdarg.h>
#include <stddef.h>
#endif
ISC_LANG_BEGINDECLS
#ifdef ISC_PLATFORM_NEEDVSNPRINTF
int
isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap)
ISC_FORMAT_PRINTF(3, 0);
......@@ -62,8 +68,14 @@ int
isc_print_snprintf(char *str, size_t size, const char *format, ...)
ISC_FORMAT_PRINTF(3, 4);
#define snprintf isc_print_snprintf
#endif /* ISC_PLATFORM_NEEDVSNPRINTF */
#ifdef ISC_PLATFORM_NEEDSPRINTF
int
isc_print_sprintf(char *str, const char *format, ...) ISC_FORMAT_PRINTF(2, 3);
#define sprintf isc_print_sprintf
#endif
ISC_LANG_ENDDECLS
#endif /* ISC_PLATFORM_NEEDVSNPRINTF */
#endif /* ISC_PRINT_H */
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: print.c,v 1.24 2003/06/24 05:10:32 marka Exp $ */
/* $Id: print.c,v 1.25 2003/06/24 06:23:58 marka Exp $ */
#include <config.h>
......@@ -31,6 +31,16 @@
#include <isc/stdlib.h>
#include <isc/util.h>
int
isc_print_sprintf(char *str, const char *format, ...) {
va_list ap;
va_start(ap, format);
vsprintf(str, format, ap);
va_end(ap);
return (strlen(str));
}
/*
* Return length of string that would have been written if not truncated.
*/
......
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