1704. [port] lwres needed a snprintf() implementation for

platforms without snprintf().  Add missing
                        "#include <isc/print.h>". [RT #12321]
This commit is contained in:
Mark Andrews 2004-08-28 06:20:14 +00:00
parent ed18f74496
commit 16a68807e1
26 changed files with 715 additions and 32 deletions

View file

@ -5,7 +5,9 @@
1705. [placeholder] rt12327
1704. [placeholder] rt12321
1704. [port] lwres needed a snprintf() implementation for
platforms without snprintf(). Add missing
"#include <isc/print.h>". [RT #12321]
1703. [bug] named would loop sending NOTIFY messages when it
failed to receive a response. [RT #12322]
@ -4772,7 +4774,6 @@
201. [cleanup] Removed the test/sdig program, it has been
replaced by bin/dig/dig.
--- 9.0.0b3 released ---
200. [bug] Failures in sending query responses to clients

View file

@ -16,7 +16,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-makekeyset.c,v 1.62 2004/03/05 05:48:19 marka Exp $ */
/* $Id: dnssec-makekeyset.c,v 1.63 2004/08/28 06:16:50 marka Exp $ */
#include <config.h>
@ -25,6 +25,7 @@
#include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/util.h>

View file

@ -16,7 +16,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signkey.c,v 1.62 2004/03/05 05:48:19 marka Exp $ */
/* $Id: dnssec-signkey.c,v 1.63 2004/08/28 06:16:50 marka Exp $ */
#include <config.h>
@ -26,6 +26,7 @@
#include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/util.h>
#include <dns/db.h>

View file

@ -16,7 +16,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signzone.c,v 1.181 2004/08/20 00:47:40 marka Exp $ */
/* $Id: dnssec-signzone.c,v 1.182 2004/08/28 06:16:51 marka Exp $ */
#include <config.h>
@ -31,6 +31,7 @@
#include <isc/mem.h>
#include <isc/mutex.h>
#include <isc/os.h>
#include <isc/print.h>
#include <isc/serial.h>
#include <isc/stdio.h>
#include <isc/string.h>

View file

@ -15,11 +15,12 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: notify.c,v 1.30 2004/03/05 04:57:48 marka Exp $ */
/* $Id: notify.c,v 1.31 2004/08/28 06:16:52 marka Exp $ */
#include <config.h>
#include <isc/log.h>
#include <isc/print.h>
#include <dns/message.h>
#include <dns/rdataset.h>

View file

@ -15,13 +15,14 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nsecify.c,v 1.3 2004/03/05 04:58:39 marka Exp $ */
/* $Id: nsecify.c,v 1.4 2004/08/28 06:16:52 marka Exp $ */
#include <config.h>
#include <stdlib.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/string.h>
#include <dns/db.h>

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rwlock_test.c,v 1.21 2004/03/05 04:58:39 marka Exp $ */
/* $Id: rwlock_test.c,v 1.22 2004/08/28 06:16:53 marka Exp $ */
#include <config.h>
@ -23,6 +23,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <isc/print.h>
#include <isc/thread.h>
#include <isc/rwlock.h>
#include <isc/string.h>

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: shutdown_test.c,v 1.20 2004/03/05 04:58:39 marka Exp $ */
/* $Id: shutdown_test.c,v 1.21 2004/08/28 06:16:53 marka Exp $ */
#include <config.h>
@ -24,6 +24,7 @@
#include <isc/app.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/task.h>
#include <isc/time.h>
#include <isc/timer.h>

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sock_test.c,v 1.49 2004/03/05 04:58:39 marka Exp $ */
/* $Id: sock_test.c,v 1.50 2004/08/28 06:16:54 marka Exp $ */
#include <config.h>
@ -24,6 +24,7 @@
#include <unistd.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/task.h>
#include <isc/socket.h>
#include <isc/timer.h>

14
configure vendored
View file

@ -14,7 +14,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
# $Id: configure,v 1.344 2004/07/23 04:35:08 marka Exp $
# $Id: configure,v 1.345 2004/08/28 06:20:13 marka Exp $
#
# Portions Copyright (C) 1996-2001 Nominum, Inc.
#
@ -29,7 +29,7 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# From configure.in Revision: 1.360 .
# From configure.in Revision: 1.361 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
@ -495,7 +495,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA STD_CINCLUDES STD_CDEFINES STD_CWARNINGS CCOPT AR ARFLAGS LN ETAGS PERL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP ISC_PLATFORM_HAVELONGLONG ISC_PLATFORM_HAVELIFCONF ISC_PLATFORM_NEEDSYSSELECTH LWRES_PLATFORM_NEEDSYSSELECTH USE_OPENSSL DST_OPENSSL_INC USE_GSSAPI DST_GSSAPI_INC DNS_CRYPTO_LIBS ALWAYS_DEFINES ISC_PLATFORM_USETHREADS ISC_THREAD_DIR MKDEPCC MKDEPCFLAGS MKDEPPROG IRIX_DNSSEC_WARNINGS_HACK purify_path PURIFY LN_S ECHO ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL O A SA LIBTOOL_MKDEP_SED LIBTOOL_MODE_COMPILE LIBTOOL_MODE_INSTALL LIBTOOL_MODE_LINK LIBBIND ISC_PLATFORM_HAVEIPV6 LWRES_PLATFORM_HAVEIPV6 ISC_PLATFORM_NEEDNETINETIN6H LWRES_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_NEEDNETINET6IN6H LWRES_PLATFORM_NEEDNETINET6IN6H ISC_PLATFORM_HAVEINADDR6 LWRES_PLATFORM_HAVEINADDR6 ISC_PLATFORM_NEEDIN6ADDRANY LWRES_PLATFORM_NEEDIN6ADDRANY ISC_PLATFORM_NEEDIN6ADDRLOOPBACK LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_FIXIN6ISADDR ISC_IPV6_H ISC_IPV6_O ISC_ISCIPV6_O ISC_IPV6_C LWRES_HAVE_SIN6_SCOPE_ID ISC_PLATFORM_HAVESCOPEID ISC_PLATFORM_HAVEIF_LADDRREQ ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_NEEDPTON ISC_PLATFORM_NEEDATON ISC_PLATFORM_HAVESALEN LWRES_PLATFORM_HAVESALEN ISC_PLATFORM_MSGHDRFLAVOR ISC_PLATFORM_NEEDPORTT ISC_LWRES_NEEDADDRINFO ISC_LWRES_NEEDRRSETINFO ISC_LWRES_SETHOSTENTINT ISC_LWRES_ENDHOSTENTINT ISC_LWRES_GETNETBYADDRINADDR ISC_LWRES_SETNETENTINT ISC_LWRES_ENDNETENTINT ISC_LWRES_GETHOSTBYADDRVOID ISC_LWRES_NEEDHERRNO ISC_LWRES_GETIPNODEPROTO ISC_LWRES_GETADDRINFOPROTO ISC_LWRES_GETNAMEINFOPROTO ISC_PLATFORM_NEEDSTRSEP ISC_PLATFORM_NEEDMEMMOVE ISC_PLATFORM_NEEDSTRTOUL ISC_PLATFORM_NEEDSTRLCPY ISC_PLATFORM_NEEDSTRLCAT ISC_PLATFORM_NEEDSPRINTF ISC_PLATFORM_NEEDVSNPRINTF ISC_EXTRA_OBJS ISC_EXTRA_SRCS ISC_PLATFORM_QUADFORMAT ISC_PLATFORM_RLIMITTYPE ISC_PLATFORM_USEDECLSPEC LWRES_PLATFORM_USEDECLSPEC ISC_PLATFORM_BRACEPTHREADONCEINIT ISC_PLATFORM_HAVEIFNAMETOINDEX OPENJADE JADETEX PDFJADETEX SGMLCATALOG HTMLSTYLE PRINTSTYLE XMLDCL DOCBOOK2MANSPEC BIND9_TOP_BUILDDIR BIND9_ISC_BUILDINCLUDE BIND9_ISCCC_BUILDINCLUDE BIND9_ISCCFG_BUILDINCLUDE BIND9_DNS_BUILDINCLUDE BIND9_LWRES_BUILDINCLUDE BIND9_BIND9_BUILDINCLUDE BIND9_VERSION LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA STD_CINCLUDES STD_CDEFINES STD_CWARNINGS CCOPT AR ARFLAGS LN ETAGS PERL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP ISC_PLATFORM_HAVELONGLONG ISC_PLATFORM_HAVELIFCONF ISC_PLATFORM_NEEDSYSSELECTH LWRES_PLATFORM_NEEDSYSSELECTH USE_OPENSSL DST_OPENSSL_INC USE_GSSAPI DST_GSSAPI_INC DNS_CRYPTO_LIBS ALWAYS_DEFINES ISC_PLATFORM_USETHREADS ISC_THREAD_DIR MKDEPCC MKDEPCFLAGS MKDEPPROG IRIX_DNSSEC_WARNINGS_HACK purify_path PURIFY LN_S ECHO ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL O A SA LIBTOOL_MKDEP_SED LIBTOOL_MODE_COMPILE LIBTOOL_MODE_INSTALL LIBTOOL_MODE_LINK LIBBIND ISC_PLATFORM_HAVEIPV6 LWRES_PLATFORM_HAVEIPV6 ISC_PLATFORM_NEEDNETINETIN6H LWRES_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_NEEDNETINET6IN6H LWRES_PLATFORM_NEEDNETINET6IN6H ISC_PLATFORM_HAVEINADDR6 LWRES_PLATFORM_HAVEINADDR6 ISC_PLATFORM_NEEDIN6ADDRANY LWRES_PLATFORM_NEEDIN6ADDRANY ISC_PLATFORM_NEEDIN6ADDRLOOPBACK LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_FIXIN6ISADDR ISC_IPV6_H ISC_IPV6_O ISC_ISCIPV6_O ISC_IPV6_C LWRES_HAVE_SIN6_SCOPE_ID ISC_PLATFORM_HAVESCOPEID ISC_PLATFORM_HAVEIF_LADDRREQ ISC_PLATFORM_HAVEIF_LADDRCONF ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_NEEDPTON ISC_PLATFORM_NEEDATON ISC_PLATFORM_HAVESALEN LWRES_PLATFORM_HAVESALEN ISC_PLATFORM_MSGHDRFLAVOR ISC_PLATFORM_NEEDPORTT ISC_LWRES_NEEDADDRINFO ISC_LWRES_NEEDRRSETINFO ISC_LWRES_SETHOSTENTINT ISC_LWRES_ENDHOSTENTINT ISC_LWRES_GETNETBYADDRINADDR ISC_LWRES_SETNETENTINT ISC_LWRES_ENDNETENTINT ISC_LWRES_GETHOSTBYADDRVOID ISC_LWRES_NEEDHERRNO ISC_LWRES_GETIPNODEPROTO ISC_LWRES_GETADDRINFOPROTO ISC_LWRES_GETNAMEINFOPROTO ISC_PLATFORM_NEEDSTRSEP ISC_PLATFORM_NEEDMEMMOVE ISC_PLATFORM_NEEDSTRTOUL ISC_PLATFORM_NEEDSTRLCPY ISC_PLATFORM_NEEDSTRLCAT ISC_PLATFORM_NEEDSPRINTF LWRES_PLATFORM_NEEDSPRINTF ISC_PLATFORM_NEEDVSNPRINTF LWRES_PLATFORM_NEEDVSNPRINTF ISC_EXTRA_OBJS ISC_EXTRA_SRCS ISC_PLATFORM_QUADFORMAT ISC_PLATFORM_RLIMITTYPE ISC_PLATFORM_USEDECLSPEC LWRES_PLATFORM_USEDECLSPEC ISC_PLATFORM_BRACEPTHREADONCEINIT ISC_PLATFORM_HAVEIFNAMETOINDEX OPENJADE JADETEX PDFJADETEX SGMLCATALOG HTMLSTYLE PRINTSTYLE XMLDCL DOCBOOK2MANSPEC BIND9_TOP_BUILDDIR BIND9_ISC_BUILDINCLUDE BIND9_ISCCC_BUILDINCLUDE BIND9_ISCCFG_BUILDINCLUDE BIND9_DNS_BUILDINCLUDE BIND9_LWRES_BUILDINCLUDE BIND9_BIND9_BUILDINCLUDE BIND9_VERSION LIBOBJS LTLIBOBJS'
ac_subst_files='BIND9_MAKE_INCLUDES BIND9_MAKE_RULES LIBISC_API LIBISCCC_API LIBISCCFG_API LIBDNS_API LIBBIND9_API LIBLWRES_API'
# Initialize some variables set by options.
@ -25453,17 +25453,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
LWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"
fi
rm -f conftest.err 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
@ -25556,13 +25559,16 @@ echo "$as_me:$LINENO: result: $ac_cv_func_vsnprintf" >&5
echo "${ECHO_T}$ac_cv_func_vsnprintf" >&6
if test $ac_cv_func_vsnprintf = yes; then
ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"
else
ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"
fi
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"
@ -28088,7 +28094,9 @@ 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,@LWRES_PLATFORM_NEEDSPRINTF@,$LWRES_PLATFORM_NEEDSPRINTF,;t t
s,@ISC_PLATFORM_NEEDVSNPRINTF@,$ISC_PLATFORM_NEEDVSNPRINTF,;t t
s,@LWRES_PLATFORM_NEEDVSNPRINTF@,$LWRES_PLATFORM_NEEDVSNPRINTF,;t t
s,@ISC_EXTRA_OBJS@,$ISC_EXTRA_OBJS,;t t
s,@ISC_EXTRA_SRCS@,$ISC_EXTRA_SRCS,;t t
s,@ISC_PLATFORM_QUADFORMAT@,$ISC_PLATFORM_QUADFORMAT,;t t

View file

@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.360 $)
AC_REVISION($Revision: 1.361 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13)
@ -1675,17 +1675,23 @@ AC_TRY_COMPILE([
ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
ISC_PLATFORM_NEEDSPRINTF="#define ISC_PLATFORM_NEEDSPRINTF"
LWRES_PLATFORM_NEEDSPRINTF="#define LWRES_PLATFORM_NEEDSPRINTF"
],
[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"]
[ISC_PLATFORM_NEEDSPRINTF="#undef ISC_PLATFORM_NEEDSPRINTF"
LWRES_PLATFORM_NEEDSPRINTF="#undef LWRES_PLATFORM_NEEDSPRINTF"]
)
AC_SUBST(ISC_PLATFORM_NEEDSPRINTF)
AC_SUBST(LWRES_PLATFORM_NEEDSPRINTF)
AC_CHECK_FUNC(vsnprintf,
[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"],
[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"
LWRES_PLATFORM_NEEDVSNPRINTF="#undef LWRES_PLATFORM_NEEDVSNPRINTF"],
[ISC_PRINT_OBJS="print.$O"
ISC_PRINT_SRCS="print.c"
ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"])
ISC_PLATFORM_NEEDVSNPRINTF="#define ISC_PLATFORM_NEEDVSNPRINTF 1"
LWRES_PLATFORM_NEEDVSNPRINTF="#define LWRES_PLATFORM_NEEDVSNPRINTF 1"])
AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
AC_SUBST(LWRES_PLATFORM_NEEDVSNPRINTF)
ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS $ISC_PRINT_OBJS"
ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS $ISC_PRINT_SRCS"

View file

@ -15,12 +15,13 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: byaddr.c,v 1.34 2004/03/05 05:09:18 marka Exp $ */
/* $Id: byaddr.c,v 1.35 2004/08/28 06:16:55 marka Exp $ */
#include <config.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <isc/task.h>
#include <isc/util.h>

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: masterdump.c,v 1.74 2004/05/14 00:55:57 marka Exp $ */
/* $Id: masterdump.c,v 1.75 2004/08/28 06:16:56 marka Exp $ */
#include <config.h>
@ -25,6 +25,7 @@
#include <isc/file.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/task.h>

View file

@ -15,10 +15,11 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.293 2004/08/10 00:38:56 marka Exp $ */
/* $Id: resolver.c,v 1.294 2004/08/28 06:16:56 marka Exp $ */
#include <config.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: time.c,v 1.26 2004/03/16 05:52:19 marka Exp $ */
/* $Id: time.c,v 1.27 2004/08/28 06:16:56 marka Exp $ */
#include <config.h>
@ -23,6 +23,7 @@
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <time.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/stdtime.h>
#include <isc/util.h>

View file

@ -17,7 +17,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] =
"$Id: inet_ntop.c,v 1.14 2004/03/05 05:10:45 marka Exp $";
"$Id: inet_ntop.c,v 1.15 2004/08/28 06:16:57 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <config.h>
@ -27,6 +27,7 @@ static char rcsid[] =
#include <string.h>
#include <isc/net.h>
#include <isc/print.h>
#define NS_INT16SZ 2
#define NS_IN6ADDRSZ 16

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lex.c,v 1.78 2004/03/05 05:10:46 marka Exp $ */
/* $Id: lex.c,v 1.79 2004/08/28 06:16:57 marka Exp $ */
#include <config.h>
@ -29,6 +29,7 @@
#include <isc/mem.h>
#include <isc/msgs.h>
#include <isc/parseint.h>
#include <isc/print.h>
#include <isc/stdio.h>
#include <isc/string.h>
#include <isc/util.h>

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: interfaceiter.c,v 1.37 2004/06/19 00:48:15 marka Exp $ */
/* $Id: interfaceiter.c,v 1.38 2004/08/28 06:16:57 marka Exp $ */
#include <config.h>
@ -36,6 +36,7 @@
#include <isc/mem.h>
#include <isc/msgs.h>
#include <isc/net.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/strerror.h>
#include <isc/string.h>

View file

@ -16,7 +16,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: cc.c,v 1.10 2004/03/05 05:12:09 marka Exp $ */
/* $Id: cc.c,v 1.11 2004/08/28 06:16:58 marka Exp $ */
#include <config.h>
@ -26,6 +26,7 @@
#include <isc/assertions.h>
#include <isc/hmacmd5.h>
#include <isc/print.h>
#include <isc/stdlib.h>
#include <isccc/alist.h>

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.29 2004/07/20 07:13:43 marka Exp $
# $Id: Makefile.in,v 1.30 2004/08/28 06:16:59 marka Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -35,14 +35,14 @@ OBJS = context.@O@ gai_strerror.@O@ getaddrinfo.@O@ gethost.@O@ \
getipnode.@O@ getnameinfo.@O@ getrrset.@O@ herror.@O@ \
lwbuffer.@O@ lwconfig.@O@ lwpacket.@O@ lwresutil.@O@ \
lwres_gabn.@O@ lwres_gnba.@O@ lwres_grbn.@O@ lwres_noop.@O@ \
lwinetaton.@O@ lwinetpton.@O@ lwinetntop.@O@
lwinetaton.@O@ lwinetpton.@O@ lwinetntop.@O@ print.@O@
# Alphabetically
SRCS = context.c gai_strerror.c getaddrinfo.c gethost.c \
getipnode.c getnameinfo.c getrrset.c herror.c \
lwbuffer.c lwconfig.c lwpacket.c lwresutil.c \
lwres_gabn.c lwres_gnba.c lwres_grbn.c lwres_noop.c \
lwinetaton.c lwinetpton.c lwinetntop.c
lwinetaton.c lwinetpton.c lwinetntop.c print.c
LIBS = @LIBS@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: getnameinfo.c,v 1.34 2004/03/05 05:12:46 marka Exp $ */
/* $Id: getnameinfo.c,v 1.35 2004/08/28 06:16:59 marka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,6 +61,7 @@
#include <lwres/lwres.h>
#include <lwres/net.h>
#include <lwres/netdb.h>
#include "print_p.h"
#include "assert_p.h"

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: platform.h.in,v 1.14 2004/03/05 05:12:53 marka Exp $ */
/* $Id: platform.h.in,v 1.15 2004/08/28 06:17:00 marka Exp $ */
#ifndef LWRES_PLATFORM_H
#define LWRES_PLATFORM_H 1
@ -78,6 +78,16 @@
*/
@LWRES_PLATFORM_USEDECLSPEC@
/*
* Defined this system needs vsnprintf() and snprintf().
*/
@LWRES_PLATFORM_NEEDVSNPRINTF@
/*
* If this system need a modern sprintf() that returns (int) not (char*).
*/
@LWRES_PLATFORM_NEEDSPRINTF@
#ifndef LWRES_PLATFORM_USEDECLSPEC
#define LIBLWRES_EXTERNAL_DATA
#else

View file

@ -17,7 +17,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] =
"$Id: lwinetntop.c,v 1.12 2004/03/05 05:12:46 marka Exp $";
"$Id: lwinetntop.c,v 1.13 2004/08/28 06:16:59 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <config.h>
@ -27,6 +27,7 @@ static char rcsid[] =
#include <string.h>
#include <lwres/net.h>
#include "print_p.h"
#define NS_INT16SZ 2
#define NS_IN6ADDRSZ 16

553
lib/lwres/print.c Normal file
View file

@ -0,0 +1,553 @@
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: print.c,v 1.2 2004/08/28 06:20:14 marka Exp $ */
#include <config.h>
#include <ctype.h>
#include <stdio.h> /* for sprintf */
#define LWRES__PRINT_SOURCE /* Used to get the lwres_print_* prototypes. */
#include <stdlib.h>
#include "assert_p.h"
#include "print_p.h"
int
lwres__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.
*/
int
lwres__print_snprintf(char *str, size_t size, const char *format, ...) {
va_list ap;
int ret;
va_start(ap, format);
ret = vsnprintf(str, size, format, ap);
va_end(ap);
return (ret);
}
/*
* Return length of string that would have been written if not truncated.
*/
int
lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
int h;
int l;
int q;
int alt;
int zero;
int left;
int plus;
int space;
int neg;
long long tmpi;
unsigned long long tmpui;
unsigned long width;
unsigned long precision;
unsigned int length;
char buf[1024];
char c;
void *v;
char *save = str;
const char *cp;
const char *head;
int count = 0;
int pad;
int zeropad;
int dot;
double dbl;
#ifdef HAVE_LONG_DOUBLE
long double ldbl;
#endif
char fmt[32];
INSIST(str != NULL);
INSIST(format != NULL);
while (*format != '\0') {
if (*format != '%') {
if (size > 1) {
*str++ = *format;
size--;
}
count++;
format++;
continue;
}
format++;
/*
* Reset flags.
*/
dot = neg = space = plus = left = zero = alt = h = l = q = 0;
width = precision = 0;
head = "";
length = pad = zeropad = 0;
do {
if (*format == '#') {
alt = 1;
format++;
} else if (*format == '-') {
left = 1;
zero = 0;
format++;
} else if (*format == ' ') {
if (!plus)
space = 1;
format++;
} else if (*format == '+') {
plus = 1;
space = 0;
format++;
} else if (*format == '0') {
if (!left)
zero = 1;
format++;
} else
break;
} while (1);
/*
* Width.
*/
if (*format == '*') {
width = va_arg(ap, int);
format++;
} else if (isdigit((unsigned char)*format)) {
char *e;
width = strtoul(format, &e, 10);
format = e;
}
/*
* Precision.
*/
if (*format == '.') {
format++;
dot = 1;
if (*format == '*') {
precision = va_arg(ap, int);
format++;
} else if (isdigit((unsigned char)*format)) {
char *e;
precision = strtoul(format, &e, 10);
format = e;
}
}
switch (*format) {
case '\0':
continue;
case '%':
if (size > 1) {
*str++ = *format;
size--;
}
count++;
break;
case 'q':
q = 1;
format++;
goto doint;
case 'h':
h = 1;
format++;
goto doint;
case 'l':
l = 1;
format++;
if (*format == 'l') {
q = 1;
format++;
}
goto doint;
case 'n':
case 'i':
case 'd':
case 'o':
case 'u':
case 'x':
case 'X':
doint:
if (precision != 0)
zero = 0;
switch (*format) {
case 'n':
if (h) {
short int *p;
p = va_arg(ap, short *);
REQUIRE(p != NULL);
*p = str - save;
} else if (l) {
long int *p;
p = va_arg(ap, long *);
REQUIRE(p != NULL);
*p = str - save;
} else {
int *p;
p = va_arg(ap, int *);
REQUIRE(p != NULL);
*p = str - save;
}
break;
case 'i':
case 'd':
if (q)
tmpi = va_arg(ap, long long int);
else if (l)
tmpi = va_arg(ap, long int);
else
tmpi = va_arg(ap, int);
if (tmpi < 0) {
head = "-";
tmpui = -tmpi;
} else {
if (plus)
head = "+";
else if (space)
head = " ";
else
head = "";
tmpui = tmpi;
}
sprintf(buf, "%llu",
tmpui);
goto printint;
case 'o':
if (q)
tmpui = va_arg(ap,
unsigned long long int);
else if (l)
tmpui = va_arg(ap, long int);
else
tmpui = va_arg(ap, int);
sprintf(buf,
alt ? "%#llo" : "%llo", tmpui);
goto printint;
case 'u':
if (q)
tmpui = va_arg(ap,
unsigned long long int);
else if (l)
tmpui = va_arg(ap, unsigned long int);
else
tmpui = va_arg(ap, unsigned int);
sprintf(buf, "%llu", tmpui);
goto printint;
case 'x':
if (q)
tmpui = va_arg(ap,
unsigned long long int);
else if (l)
tmpui = va_arg(ap, unsigned long int);
else
tmpui = va_arg(ap, unsigned int);
if (alt) {
head = "0x";
if (precision > 2)
precision -= 2;
}
sprintf(buf, "%llx", tmpui);
goto printint;
case 'X':
if (q)
tmpui = va_arg(ap,
unsigned long long int);
else if (l)
tmpui = va_arg(ap, unsigned long int);
else
tmpui = va_arg(ap, unsigned int);
if (alt) {
head = "0X";
if (precision > 2)
precision -= 2;
}
sprintf(buf, "%llX", tmpui);
goto printint;
printint:
if (precision != 0 || width != 0) {
length = strlen(buf);
if (length < precision)
zeropad = precision - length;
else if (length < width && zero)
zeropad = width - length;
if (width != 0) {
pad = width - length -
zeropad - strlen(head);
if (pad < 0)
pad = 0;
}
}
count += strlen(head) + strlen(buf) + pad +
zeropad;
if (!left) {
while (pad > 0 && size > 1) {
*str++ = ' ';
size--;
pad--;
}
}
cp = head;
while (*cp != '\0' && size > 1) {
*str++ = *cp++;
size--;
}
while (zeropad > 0 && size > 1) {
*str++ = '0';
size--;
zeropad--;
}
cp = buf;
while (*cp != '\0' && size > 1) {
*str++ = *cp++;
size--;
}
while (pad > 0 && size > 1) {
*str++ = ' ';
size--;
pad--;
}
break;
default:
break;
}
break;
case 's':
cp = va_arg(ap, char *);
REQUIRE(cp != NULL);
if (precision != 0) {
/*
* cp need not be NULL terminated.
*/
const char *tp;
unsigned long n;
n = precision;
tp = cp;
while (n != 0 && *tp != '\0')
n--, tp++;
length = precision - n;
} else {
length = strlen(cp);
}
if (width != 0) {
pad = width - length;
if (pad < 0)
pad = 0;
}
count += pad + length;
if (!left)
while (pad > 0 && size > 1) {
*str++ = ' ';
size--;
pad--;
}
if (precision != 0)
while (precision > 0 && *cp != '\0' &&
size > 1) {
*str++ = *cp++;
size--;
precision--;
}
else
while (*cp != '\0' && size > 1) {
*str++ = *cp++;
size--;
}
while (pad > 0 && size > 1) {
*str++ = ' ';
size--;
pad--;
}
break;
case 'c':
c = va_arg(ap, int);
if (width > 0) {
count += width;
width--;
if (left) {
*str++ = c;
size--;
}
while (width-- > 0 && size > 1) {
*str++ = ' ';
size--;
}
if (!left && size > 1) {
*str++ = c;
size--;
}
} else {
count++;
if (size > 1) {
*str++ = c;
size--;
}
}
break;
case 'p':
v = va_arg(ap, void *);
sprintf(buf, "%p", v);
length = strlen(buf);
if (precision > length)
zeropad = precision - length;
if (width > 0) {
pad = width - length - zeropad;
if (pad < 0)
pad = 0;
}
count += length + pad + zeropad;
if (!left)
while (pad > 0 && size > 1) {
*str++ = ' ';
size--;
pad--;
}
cp = buf;
if (zeropad > 0 && buf[0] == '0' &&
(buf[1] == 'x' || buf[1] == 'X')) {
if (size > 1) {
*str++ = *cp++;
size--;
}
if (size > 1) {
*str++ = *cp++;
size--;
}
while (zeropad > 0 && size > 1) {
*str++ = '0';
size--;
zeropad--;
}
}
while (*cp != '\0' && size > 1) {
*str++ = *cp++;
size--;
}
while (pad > 0 && size > 1) {
*str++ = ' ';
size--;
pad--;
}
break;
case 'D': /*deprecated*/
INSIST("use %ld instead of %D" == NULL);
case 'O': /*deprecated*/
INSIST("use %lo instead of %O" == NULL);
case 'U': /*deprecated*/
INSIST("use %lu instead of %U" == NULL);
case 'L':
#ifdef HAVE_LONG_DOUBLE
l = 1;
#else
INSIST("long doubles are not supported" == NULL);
#endif
/*FALLTHROUGH*/
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
if (!dot)
precision = 6;
/*
* IEEE floating point.
* MIN 2.2250738585072014E-308
* MAX 1.7976931348623157E+308
* VAX floating point has a smaller range than IEEE.
*
* precisions > 324 don't make much sense.
* if we cap the precision at 512 we will not
* overflow buf.
*/
if (precision > 512)
precision = 512;
sprintf(fmt, "%%%s%s.%lu%s%c", alt ? "#" : "",
plus ? "+" : space ? " " : "",
precision, l ? "L" : "", *format);
switch (*format) {
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
#ifdef HAVE_LONG_DOUBLE
if (l) {
ldbl = va_arg(ap, long double);
sprintf(buf, fmt, ldbl);
} else
#endif
{
dbl = va_arg(ap, double);
sprintf(buf, fmt, dbl);
}
length = strlen(buf);
if (width > 0) {
pad = width - length;
if (pad < 0)
pad = 0;
}
count += length + pad;
if (!left)
while (pad > 0 && size > 1) {
*str++ = ' ';
size--;
pad--;
}
cp = buf;
while (*cp != ' ' && size > 1) {
*str++ = *cp++;
size--;
}
while (pad > 0 && size > 1) {
*str++ = ' ';
size--;
pad--;
}
break;
default:
continue;
}
break;
default:
continue;
}
format++;
}
if (size > 0)
*str = '\0';
return (count);
}

86
lib/lwres/print_p.h Normal file
View file

@ -0,0 +1,86 @@
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: print_p.h,v 1.2 2004/08/28 06:20:14 marka Exp $ */
#ifndef LWRES_PRINT_P_H
#define LWRES_PRINT_P_H 1
/***
*** Imports
***/
#include <lwres/lang.h>
#include <lwres/platform.h>
/*
* This block allows lib/lwres/print.c to be cleanly compiled even if
* the platform does not need it. The standard Makefile will still
* not compile print.c or archive print.o, so this is just to make test
* compilation ("make print.o") easier.
*/
#if !defined(LWRES_PLATFORM_NEEDVSNPRINTF) && defined(LWRES__PRINT_SOURCE)
#define LWRES_PLATFORM_NEEDVSNPRINTF
#endif
#if !defined(LWRES_PLATFORM_NEEDSPRINTF) && defined(LWRES__PRINT_SOURCE)
#define LWRES_PLATFORM_NEEDSPRINTF
#endif
/***
*** Macros.
***/
#ifdef __GNUC__
#define LWRES_FORMAT_PRINTF(fmt, args) \
__attribute__((__format__(__printf__, fmt, args)))
#else
#define LWRES_FORMAT_PRINTF(fmt, args)
#endif
/***
*** Functions
***/
#ifdef LWRES_PLATFORM_NEEDVSNPRINTF
#include <stdarg.h>
#include <stddef.h>
#endif
LWRES_LANG_BEGINDECLS
#ifdef LWRES_PLATFORM_NEEDVSNPRINTF
int
lwres__print_vsnprintf(char *str, size_t size, const char *format, va_list ap)
LWRES_FORMAT_PRINTF(3, 0);
#define vsnprintf lwres__print_vsnprintf
int
lwres__print_snprintf(char *str, size_t size, const char *format, ...)
LWRES_FORMAT_PRINTF(3, 4);
#define snprintf lwres__print_snprintf
#endif /* LWRES_PLATFORM_NEEDVSNPRINTF */
#ifdef LWRES_PLATFORM_NEEDSPRINTF
int
lwres__print_sprintf(char *str, const char *format, ...) LWRES_FORMAT_PRINTF(2, 3);
#define sprintf lwres__print_sprintf
#endif
LWRES_LANG_ENDDECLS
#endif /* LWRES_PRINT_P_H */

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_api.c,v 1.53 2004/06/21 05:36:40 marka Exp $ */
/* $Id: t_api.c,v 1.54 2004/08/28 06:17:00 marka Exp $ */
#include <config.h>
@ -33,6 +33,7 @@
#include <isc/boolean.h>
#include <isc/commandline.h>
#include <isc/print.h>
#include <isc/string.h>
#include <dns/compress.h>