Index: misc/host/Makefile
diff -u misc/host/Makefile:1.11 misc/host/Makefile:1.14
--- misc/host/Makefile:1.11	Mon Mar 31 16:59:02 2003
+++ misc/host/Makefile	Tue May 27 15:38:36 2003
@@ -1,5 +1,5 @@
 #
-#ident "@(#)host:HOST-20030405:Makefile,v 1.11 2003/03/31 21:59:02 woods Exp"
+#ident "@(#)host:HOST-20030527:Makefile,v 1.14 2003/05/27 19:38:36 woods Exp"
 #
 # from:	@(#)Makefile            e07@nikhef.nl (Eric Wassenaar) 991515
 
@@ -54,6 +54,10 @@
 #SYSDEFS = -DULTRIX_RESOLV
 #endif
 
+#if defined(sunos-4)
+#SYSDEFS = -Dstrerror=isc_strerror
+#endif
+
 #if defined(solaris) && You are using its default broken resolver library
 #SYSDEFS = -DNO_YP_LOOKUP
 #endif
@@ -71,24 +75,20 @@
 #CONFIGDEFS = -DOLD_RES_STATE
 #endif
 
-#if defined(BIND_4_8) && You want to use the default bind res_send()
-#CONFIGDEFS = -DBIND_RES_SEND
-#endif
-
-#if defined(BIND_4_9) || newer && You want to use the special host res_send()
-#CONFIGDEFS = -DHOST_RES_SEND
-#endif
-
 # By default we want to use the latest avaliable resolver API.
 #
 # Keep in mind that if your resolver library has hooks for using
-# non-DNS naming systems (YP, HESIOD, etc.), and if your target
+# non-DNS naming systems (YP/NIS, HESIOD, etc.), and if your target
 # system(s) might make use of those hooks, then using the system
 # resolver will cause grief to "host" users who expect only to query
-# the DNS!  Either install a pure BIND resolver library to avoid this,
-# or switch to the HOST_RES_SEND option above.
+# the DNS!
 #
-CONFIGDEFS = -DBIND_RES_SEND
+# Either install a pure BIND resolver library and link host against it
+# to avoid this, or enable the HOST_RES_SEND option.
+#
+#if defined(BIND_4_9) || newer && You still want to use the special host res_send()
+#CONFIGDEFS = -DHOST_RES_SEND
+#endif
 
 # ----------------------------------------------------------------------
 # Include file directories.
@@ -140,6 +140,12 @@
  -Wshadow
 #endif
 
+#if $(__GNULD__) >= 1
+GNULDWARNFLAGS = -W \
+ -Wall \
+ -Wid-clash-30
+#endif
+
 #if $(__GNUC__) >= 2
 GCC2WARNFLAGS = -Waggregate-return \
  -Wcast-align \
@@ -192,12 +198,18 @@
 #
 # This program _must_ be linked with the resolver library associated
 # with the header files you compiled with.
+#
+# GNU LibC (i.e. all variants of GNU/Linux) has a horrible mis-mash of
+# half-baked header files and mangled resolver subroutines, at least
+# as of 2.3.x.  E.g. there's a __NAMESER define in <netdb.h>
+# indicating it to be BIND-8 compatible, but there is no implementation
+# of getipnodebyname() in sight.
 # ----------------------------------------------------------------------
 
 #if defined(SCO) && default
 #RES_LIB = -lsocket
 #endif
-#if defined(NEED_LIBRESOLV) || (sunos5.x)
+#if defined(NEED_LIBRESOLV) || (sunos5.x) || defined(__LINUX__) || defined(__GLIBC__)
 #RES_LIB = -lresolv
 #endif
 #if defined(LOCAL_LIBBIND) || (sunos5.x < 5.9)
@@ -225,7 +237,7 @@
 # Unfortunately SunOS-5.9 has only libresolv.so !!!
 #
 #if defined(NEED_LIBRESOLV) && !defined(sunos5.x)
-LDFLAGS = -static
+LDFLAGS = -static $(GNULDWARNFLAGS)
 #endif
 
 # ----------------------------------------------------------------------
Index: misc/host/Makefile.BSD
diff -u misc/host/Makefile.BSD:1.5 misc/host/Makefile.BSD:1.7
--- misc/host/Makefile.BSD:1.5	Fri Apr  4 22:32:55 2003
+++ misc/host/Makefile.BSD	Fri May 16 20:51:59 2003
@@ -1,29 +1,42 @@
 #
-#	Makefile.BSD - input for pmake (for use in base OS or pkgsrc)
+#	Makefile.BSD - input for pmake (for use in base OS or for packages)
 #
 # Define control variables on the command-line as necessary.
 #
-#	make -f Makefile.BSD __NetBSD__=1 __GNUC__=2
+#	make -f Makefile.BSD __NetBSD__=1 __GNUC__=2 __GNULD__=2
 #
-#ident	"@(#)newsyslog:HOST-20030405:Makefile.BSD,v 1.5 2003/04/05 03:32:55 woods Exp"
+#ident	"@(#)newsyslog:HOST-20030527:Makefile.BSD,v 1.7 2003/05/17 00:51:59 woods Exp"
 #
 
-.if defined(HOSTNAME) && $(HOSTNAME) == "proven"
+
+# are we running in the full NetBSD build environment?
+.if defined(MAKE) && defined(MACHINE) && defined(MACHINE_ARCH) && defined(TOOLDIR) && defined(USETOOLS)
+
+__NetBSD__ = 1
+__GNUC__ = 2
+__GNULD__ = 2
+
+.elif defined(HOSTNAME) && $(HOSTNAME) == "proven"
+
 PREFIX ?= /usr/pkg
 CC = PATH=/usr/pkg/gcc-ssp/bin:$$PATH /usr/pkg/gcc-ssp/bin/cc
 CFLAGS += -pipe -fstack-protector
 __NetBSD__ = 1
 __GNUC__ = 2
-.endif
-.if defined(HOSTNAME) && $(HOSTNAME) == "proven-bind8"
+__GNULD__ = 2
+
+.elif defined(HOSTNAME) && $(HOSTNAME) == "proven-bind8"
+
 PREFIX ?= /usr/pkg
 CC = PATH=/usr/pkg/gcc-ssp/bin:$$PATH /usr/pkg/gcc-ssp/bin/cc
 CFLAGS += -pipe -fstack-protector
-CPPFLAGS += -I$(PREFIX)/bind/include
+CPPFLAGS += -I$(PREFIX)/bind/include -DHOST_RES_SEND
 LDFLAGS += -L$(PREFIX)/lib
 LDADD += -lbind
 __NetBSD__ = 1
 __GNUC__ = 2
+__GNULD__ = 2
+
 .endif
 
 CPPFLAGS += -DDEBUG
@@ -52,15 +65,16 @@
 
 HEADERS = port.h conf.h exit.h type.h rrec.h defs.h host.h glob.h
 
-DOCS =	RELEASE_NOTES
-MISCS = malloc.c README_NT
-
 SCRIPT_SRCS = nscheck.sh nslookup.sh mxlookup.sh rblookup.sh
-SCRIPTS = nscheck nslookup mxlookup rblookup
+SCRIPTS = nscheck mxlookup rblookup
+.if defined(FAKE_NSLOOKUP)
+SCRIPTS += nslookup
+.endif
 
-FILES =	${PROG} ${SCRIPTS}
+DOCS =	RELEASE_NOTES
+MISCS = malloc.c README_NT
 
-ALL_FILES = Makefile $(DOCS) $(HDRS) $(SRCS) $(MANS) $(UTILS) $(MISCS)
+ALL_FILES = Makefile Makefile.BSD $(DOCS) $(HDRS) $(SRCS) $(MANS) $(UTILS) $(MISCS)
 
 # GCC apparently has buggy parameter width detection
 NOGCCERROR = 1
@@ -69,6 +83,8 @@
 # Take control of our own warning flags (WARNS=2 is not yet appropriate)
 WARNS = 0
 
+__GNUC__ ?= 1
+.if $(__GNUC__) >= 1
 # no, we're not that pedantic!
 #CWARNFLAGS += -pedantic
 #
@@ -82,6 +98,7 @@
 CWARNFLAGS += -Wcomment
 #
 # in addition to -Wall
+CWARNFLAGS += -Wtraditional
 CWARNFLAGS += -Wcast-qual
 # -Wid-clash-LEN is sadly no longer supported in 3.2.2
 CWARNFLAGS += -Wid-clash-30
@@ -93,40 +110,52 @@
 #
 # this isn't mentioned in 1.42's manual but causes no error
 CWARNFLAGS += -Wstrict-prototypes
+.endif
 
-__GNUC__ ?= 1
 .if $(__GNUC__) >= 2
 CWARNFLAGS += -Waggregate-return
+CWARNFLAGS += -Wcast-align
 CWARNFLAGS += -Wchar-subscripts
 CWARNFLAGS += -Wconversion
 CWARNFLAGS += -Wmissing-declarations
 CWARNFLAGS += -Wmissing-prototypes
-CWARNFLAGS += -Wno-format-extra-args
+CWARNFLAGS += -Wno-long-long
 # the rest aren't in the manual, but work on at least 2.9x.x
-# -Wundef isn't in 2.7.2, but if you're still using 2.7.2 you may be
-# suffering from far more bugs and problems than you might know!
+CWARNFLAGS += -Wformat-extra-args
+# -Wundef isn't in 2.7.2, but then again if you're still using 2.7.2
+# you may be suffering from far more code generation bugs and other
+# compiler problems than you might know!
 CWARNFLAGS += -Wundef
 CWARNFLAGS += -Wlarger-than-65536
 CWARNFLAGS += -Wbad-function-cast
 .endif
+
 .if $(__GNUC__) >= 3
 # Yuck:  this is broken in at least 3.2.2...
 #CWARNFLAGS += -Wunreachable-code
 .endif
 
-WFORMAT = 0
-.if defined(__NetBSD__) && $(CC) == "cc"
+#WFORMAT = 0
+.if defined(__NetBSD__) && defined(__GNUC__) && $(CC) == "cc"
 # Some magic is missing -- I can't get this to shut up....
-CWARNFLAGS += -Wnetbsd-format-audit
-.elif defined(__FreeBSD__)
+#CWARNFLAGS += -Wnetbsd-format-audit
+.elif defined(__FreeBSD__) && defined(__GNUC__)
 # Some magic is missing -- I can't get this to shut up....
-CWARNFLAGS += -Wnon-const-format
+#CWARNFLAGS += -Wnon-const-format
 .endif
 
 .if !defined(__NetBSD__) && !defined(__FreeBSD__)
 CFLAGS += $(CWARNFLAGS)
 .endif
 
+__GNULD__ ?= 1
+.if $(__GNULD__) >= 1
+LDFLAGS += -W
+LDFLAGS += -Wall
+LDFLAGS += -Wid-clash-30
+LDFLAGS += -Wl,--warn-common
+.endif
+
 SOELIM = soelim
 
 .SUFFIXES: .5so .5
@@ -135,7 +164,7 @@
 
 .sh:
 	@rm -f $@
-	sed -e 's,@BINDIR@,$(BINDIR),g' -e 's,@CONFDIR@,$(CONFDIR),g' < $@.sh > $@
+	sed -e 's,@BINDIR@,$(BINDIR),g' -e 's,@CONFDIR@,$(CONFDIR),g' < ${.CURDIR}/$@.sh > $@
 	chmod +x $@
 
 .if !target(clobber)
Index: misc/host/RELEASE_NOTES
diff -u misc/host/RELEASE_NOTES:1.7 misc/host/RELEASE_NOTES:1.8
--- misc/host/RELEASE_NOTES:1.7	Sat Apr  5 22:46:56 2003
+++ misc/host/RELEASE_NOTES	Tue May 27 15:38:56 2003
@@ -1,6 +1,6 @@
 # -*-indented-text-*-
 #
-#ident "@(#)host:HOST-20030405:RELEASE_NOTES,v 1.7 2003/04/06 03:46:56 woods Exp"
+#ident "@(#)host:HOST-20030527:RELEASE_NOTES,v 1.8 2003/05/27 19:38:56 woods Exp"
 #
 
 	URL:		ftp://ftp.weird.com/pub/local/host.tar.gz
@@ -20,6 +20,13 @@
 # ----------------------------------------------------------------------
 # Description of important user-visible changes per release
 # ----------------------------------------------------------------------
+
+2003/05/27
+
+	- minor updates for some DNS blacklists in the rblookup script, etc.
+
+	- fixed minor portability issues for GNU/Linux (really GNU LibC), as
+          well as for FreeBSD.
 
 2003/04/05
 
Index: misc/host/ToDo
diff -u /dev/null misc/host/ToDo:1.1
--- /dev/null	Tue May 27 15:44:26 2003
+++ misc/host/ToDo	Fri May 16 21:04:43 2003
@@ -0,0 +1,2 @@
+- check that the names in the answer records match the names we asked
+  for (taking CNAMEs into account where they're allowed).
Index: misc/host/addr.c
diff -u misc/host/addr.c:1.5 misc/host/addr.c:1.6
--- misc/host/addr.c:1.5	Fri Apr  4 16:44:21 2003
+++ misc/host/addr.c	Fri May 16 20:57:32 2003
@@ -17,7 +17,7 @@
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ident "@(#)host:HOST-20030405:addr.c,v 1.5 2003/04/04 21:44:21 woods Exp"
+#ident "@(#)host:HOST-20030527:addr.c,v 1.6 2003/05/17 00:57:32 woods Exp"
 
 #if 0
 static char Version[] = "@(#)addr.c	e07@nikhef.nl (Eric Wassenaar) 990605";
@@ -63,7 +63,7 @@
 	 *
 	 * XXX also need to deal properly with IPv6 too....
 	 */
-#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006)
+#if defined(HAVE_GETIPNODEBYNAME)
 	if (!(hp = getipnodebyname(name, AF_INET, AI_ALL | AI_V4MAPPED, &my_h_errno))) {
 		set_h_errno(my_h_errno);
 		ns_error(name, T_A, C_IN, server);
@@ -163,7 +163,7 @@
 	 *
 	 * XXX also need to deal properly with IPv6 too....
 	 */
-#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006)
+#if defined(HAVE_GETIPNODEBYADDR)
 	if (!(hp = getipnodebyaddr((void *) &inaddr, sizeof(inaddr), AF_INET, &my_h_errno))) {
 		set_h_errno(my_h_errno);
 		ns_error(name, T_PTR, C_IN, server);
Index: misc/host/defs.h
diff -u misc/host/defs.h:1.18 misc/host/defs.h:1.19
--- misc/host/defs.h:1.18	Sat Apr  5 22:12:22 2003
+++ misc/host/defs.h	Wed Apr  9 02:10:41 2003
@@ -4,7 +4,7 @@
 **	@(#)defs.h              e07@nikhef.nl (Eric Wassenaar) 991529
 */
 
-#ident "@(#)host:HOST-20030405:defs.h,v 1.18 2003/04/06 03:12:22 woods Exp"
+#ident "@(#)host:HOST-20030527:defs.h,v 1.19 2003/04/09 06:10:41 woods Exp"
 
 /*
 ** Internal modules of the host utility
@@ -153,9 +153,6 @@
 
 #ifdef HOST_RES_SEND
 int res_send		__P((const qbuf_t *, int, qbuf_t *, int));
-static bool_t check_from __P((void));
-static int send_stream	__P((struct sockaddr_in *, qbuf_t *, int, qbuf_t *, int));
-static int send_dgram	__P((struct sockaddr_in *, qbuf_t *, int, qbuf_t *, int));
 #endif /*HOST_RES_SEND*/
 
 int host_res_socket	__P((int, int, int));
@@ -163,7 +160,7 @@
 int host_res_blocking	__P((int, bool_t));
 sigtype_t timer		__P((int));
 int host_res_connect	__P((int, struct sockaddr_in *, socklen_t));
-int host_res_write	__P((int, struct sockaddr_in *, char *, char *, size_t));
+int host_res_write	__P((int, struct sockaddr_in *, char *, const char *, size_t));
 int host_res_read	__P((int, struct sockaddr_in *, char *, char *, size_t));
 int host_res_read_stream __P((int, struct sockaddr_in *, char *, char *, size_t));
 int recv_sock		__P((int, char *, size_t));
Index: misc/host/geth.c
diff -u misc/host/geth.c:1.9 misc/host/geth.c:1.10
--- misc/host/geth.c:1.9	Fri Apr  4 22:31:38 2003
+++ misc/host/geth.c	Fri May 16 20:57:23 2003
@@ -17,7 +17,7 @@
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ident "@(#)host:HOST-20030405:geth.c,v 1.9 2003/04/05 03:31:38 woods Exp"
+#ident "@(#)host:HOST-20030527:geth.c,v 1.10 2003/05/17 00:57:23 woods Exp"
 
 #if 0
 static char Version[] = "@(#)geth.c	e07@nikhef.nl (Eric Wassenaar) 990605";
@@ -49,11 +49,11 @@
 	querybuf_t answer;
 	struct hostent *hp;
 	register int n;
-#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006)
+#if defined(HAVE_GETIPNODEBYNAME)
 	int my_h_errno;
 #endif
 
-#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006)
+#if defined(HAVE_GETIPNODEBYNAME)
 	if (!(hp = getipnodebyname(name, AF_INET, AI_ALL | AI_V4MAPPED, &my_h_errno)))
 		set_h_errno(my_h_errno);
 #else
@@ -74,7 +74,7 @@
 	if ((verbose > print_level + 1) && (print_level < 1))
 		(void) print_info(&answer, n, name, T_A, C_IN, FALSE);
 
-#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006)
+#if defined(HAVE_GETIPNODEBYNAME)
 	if (!(hp = getipnodebyname(name, AF_INET, AI_ALL | AI_V4MAPPED, &my_h_errno)))
 		set_h_errno(my_h_errno);
 #else
@@ -108,11 +108,11 @@
 	querybuf_t answer;
 	struct hostent *hp;
 	register int n;
-#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006)
+#if defined(HAVE_GETIPNODEBYADDR)
 	int my_h_errno;
 #endif
 
-#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006)
+#if defined(HAVE_GETIPNODEBYADDR)
 	if (!(hp = getipnodebyaddr((const void *) addr, size, family, &my_h_errno)))
 		set_h_errno(my_h_errno);
 #else
@@ -139,7 +139,7 @@
 	if ((verbose > print_level + 1) && (print_level < 1))
 		(void) print_info(&answer, n, name, T_PTR, C_IN, FALSE);
 
-#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006)
+#if defined(HAVE_GETIPNODEBYADDR)
 	if (!(hp = getipnodebyaddr((const void *) addr, size, family, &my_h_errno)))
 		set_h_errno(my_h_errno);
 #else
@@ -154,11 +154,12 @@
 ** -------------------------------------------
 */
 
+/* ARGSUSED */
 void
 geth_freehostent(hp)
-	struct hostent *hp;
+	struct hostent *hp;			/* UNUSED if !HAVE_FREEHOSTENT */
 {
-#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006)
+#if defined(HAVE_FREEHOSTENT)
 	freehostent(hp);
 #endif
 }
Index: misc/host/host.h
diff -u misc/host/host.h:1.11 misc/host/host.h:1.12
--- misc/host/host.h:1.11	Thu Apr  3 23:03:08 2003
+++ misc/host/host.h	Fri May 16 20:56:20 2003
@@ -4,7 +4,7 @@
 ** from: @(#)host.h              e07@nikhef.nl (Eric Wassenaar) 991529
 */
 
-#ident "@(#)host:HOST-20030405:host.h,v 1.11 2003/04/04 04:03:08 woods Exp"
+#ident "@(#)host:HOST-20030527:host.h,v 1.12 2003/05/17 00:56:20 woods Exp"
 
 #if defined(apollo) && defined(lint)
 # define __attribute(x)		/* XXX ??? */
@@ -53,11 +53,11 @@
 # include <netinet/ip.h>
 #endif
 
-#if TIME_WITH_SYS_TIME
+#ifdef TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # include <time.h>
 #else
-# if HAVE_SYS_TIME_H
+# ifdef HAVE_SYS_TIME_H
 #  include <sys/time.h>
 # else
 #  include <time.h>
Index: misc/host/main.c
diff -u misc/host/main.c:1.16 misc/host/main.c:1.17
--- misc/host/main.c:1.16	Sat Apr  5 22:18:57 2003
+++ misc/host/main.c	Fri May 16 20:59:21 2003
@@ -39,7 +39,7 @@
  * re-distribute your own modifications to others.
  */
 
-#ident "@(#)host:HOST-20030405:main.c,v 1.16 2003/04/06 03:18:57 woods Exp"
+#ident "@(#)host:HOST-20030527:main.c,v 1.17 2003/05/17 00:59:21 woods Exp"
 
 #if 0
 static char Version[] = "@(#)main.c	e07@nikhef.nl (Eric Wassenaar) 991529";
@@ -691,11 +691,11 @@
 				break;
 
 			case 'V' :
-#if defined(__NAMESER) && defined(BIND_RES_SEND)
+#if defined(__NAMESER) && !defined(HOST_RES_SEND)
 				printf("Host version %s, BIND-8 resolver API version: %d\n", version, __NAMESER);
-#elif defined(__BIND) && defined(BIND_RES_SEND)
+#elif defined(__BIND) && !defined(HOST_RES_SEND)
 				printf("Host version %s, BIND-4 resolver API version: %d\n", version, __BIND);
-#elif defined(BIND_4_8) && defined(BIND_RES_SEND)
+#elif defined(BIND_4_8) && !defined(HOST_RES_SEND)
 				printf("Host version %s, BIND 4.8.x resolver\n", version);
 #elif defined(__NAMESER) && defined(HOST_RES_SEND)
 				printf("Host version %s, using private res_send() with BIND-8 resolver API version %d\n", version, __NAMESER);
Index: misc/host/port.h
diff -u misc/host/port.h:1.14 misc/host/port.h:1.15
--- misc/host/port.h:1.14	Sat Apr  5 22:19:55 2003
+++ misc/host/port.h	Fri May 16 21:02:49 2003
@@ -3,7 +3,7 @@
 **
 */
 
-#ident "@(#)host:HOST-20030405:port.h,v 1.14 2003/04/06 03:19:55 woods Exp"
+#ident "@(#)host:HOST-20030527:port.h,v 1.15 2003/05/17 01:02:49 woods Exp"
 /*
  * from: @(#)port.h              e07@nikhef.nl (Eric Wassenaar) 991328
  */
@@ -73,6 +73,18 @@
 */
 
 /*
+ * GNU LibC has a horrible mis-mash of half-baked header files and mangled
+ * resolver subroutines, at least as of 2.3.x.  E.g. there's a __NAMESER define
+ * in <netdb.h> indicating it to be BIND-8 compatible, but there's no
+ * getipnodebyname() in sight.  If we remove the __NAMESER definition then
+ * we'll just fall back to assuming BIND-4 compatability, and that does, for
+ * now, seem to be true enough.
+ */
+#if defined(__NAMESER) && defined(__GLIBC__)
+# undef __NAMESER		/* bloody lying bastards! */
+#endif
+
+/*
  * Every other conceivable version of the BIND-based resolvers should have one
  * or both of __BIND and/or __NAMESER defined to define their API version.
  */
@@ -124,11 +136,25 @@
 #endif
 
 #if !defined(HAVE_INET_ATON) && \
-    ((defined(__BIND) && (__BIND - 0) > 19950621) || \
-     (defined(__NAMESER) && (__NAMESER - 0) > 19961001) || \
+    ((defined(__BIND) && (__BIND - 0) >= 19950621) || \
+     (defined(__NAMESER) && (__NAMESER - 0) >= 19961001) || \
      (defined(BSD4_3) && !defined(BSD4_4)) || \
      (defined(BSD) && (BSD >= 199103)))
-# define HAVE_INET_ATON
+# define HAVE_INET_ATON	1
+#endif
+
+/*
+ * getipnodeby*() and freehostent() were added in BIND-8.2.2
+ *
+ * FreeBSD added getipnodeby*() separately, obtaining them from KAME, but
+ * without adjusting their resolver API version number (leaving it at the
+ * BIND-8.1.2 level)
+ */
+#if defined(__NAMESER) && ((__NAMESER - 0) >= 19991006 || \
+                           defined(__FreeBSD__) && (__NAMESER - 0) >= 19961001)
+# define HAVE_GETIPNODEBYNAME	1
+# define HAVE_GETIPNODEBYADDR	1
+# define HAVE_FREEHOSTENT	1
 #endif
 
 /*
@@ -139,13 +165,10 @@
  * will be run on uses such foreign schemes -- host is intended to be used only
  * with the DNS)
  */
-#if !defined(HOST_RES_SEND) && !defined(BIND_RES_SEND)
-# if (defined(__BIND) && (__BIND - 0) > 19950621) || \
-     (defined(__NAMESER) && (__NAMESER - 0) > 19961001)
-#  define BIND_RES_SEND		/* use the default BIND res_send() */
-# else
-#  define HOST_RES_SEND		/* use the special host res_send() */
-# endif
+#if !defined(HOST_RES_SEND) && \
+    (!defined(__BIND) || (__BIND - 0) < 19950621) && \
+    (!defined(__NAMESER) || (__NAMESER - 0) < 19961001)
+#  define HOST_RES_SEND	1	/* use the special host res_send() */
 #endif
 
 /*
@@ -172,29 +195,29 @@
 #if defined(BIND_4_8)
 typedef struct rrec	rrec_t;
 #else
-# if (defined(__BIND) && (__BIND - 0) > 19950621) || \
-     (defined(__NAMESER) && (__NAMESER - 0) > 19961001)
+# if (defined(__BIND) && (__BIND - 0) >= 19950621) || \
+     (defined(__NAMESER) && (__NAMESER - 0) >= 19961001)
 typedef u_char		rrec_t;
 # else
 typedef char		rrec_t;
 # endif
 #endif
 
-#if (defined(__BIND) && (__BIND - 0) > 19950621) || \
-    (defined(__NAMESER) && (__NAMESER - 0) > 19961001)
+#if (defined(__BIND) && (__BIND - 0) >= 19950621) || \
+    (defined(__NAMESER) && (__NAMESER - 0) >= 19961001)
 typedef u_char		qbuf_t;
 #else
 typedef char		qbuf_t;
 #endif
 
-#if (defined(__BIND) && (__BIND - 0) > 19950621) || \
-    (defined(__NAMESER) && (__NAMESER - 0) > 19961001)
+#if (defined(__BIND) && (__BIND - 0) >= 19950621) || \
+    (defined(__NAMESER) && (__NAMESER - 0) >= 19961001)
 typedef char		nbuf_t;
 #else
 typedef u_char		nbuf_t;
 #endif
 
-#if !defined(__NAMESER)
+#if !defined(__NAMESER) && !defined(__GLIBC__)
 # define ns_get16(src)		_getshort(src)
 # define ns_get32(src)		_getlong(src)
 # define ns_put16(src, dst)	__putshort((unsigned short) src, dst)
@@ -212,9 +235,10 @@
 
 /*
  * FreeBSD (and Darwin in its image) is a bit brain-dead in the way they do
- * this -- they use the fact that _BSD_SOCKLEN_T_ is NOT defined in order to
- * typedef socklen_t at the earliest point it's needed.  However they leave no
- * means for applications to know if the typedef has already been done.
+ * this and still follow the ancient 4.4BSD style of using the fact that
+ * _BSD_SOCKLEN_T_ is NOT defined in order to typedef socklen_t at the earliest
+ * point it's needed.  However they leave no means for applications to know if
+ * the typedef has already been done.
  *
  * FYI: In NetBSD socklen_t came into use just before 1.3J:
  *
@@ -240,9 +264,14 @@
  * BSD Socket API buffer length type.
  *
  * Deal with the other parts of the P1003.1g API change which the POSIX
- * committee didn't seem to address....
+ * committee didn't seem to address.  I.e. use this for the "buflen" or "len"
+ * parameters of functions such as send(2), sendto(2), recv(2), recvfrom(2),
+ * etc.  (not the address length, which should be a socklen_t, just the buffer
+ * length).
  *
- * (using the NetBSD template for __socklen_t and socklen_t).
+ * Unfortunately this doesn't deal with the problem that the passed in length
+ * is now a size_t width integer, but the returned type is only a ssize_t width
+ * integer....  Standards.  Sigh.
  *
  * Perhaps the defined(__sun__) shouldn't be there on the _SOCKLEN_T line....
  */
Index: misc/host/rblookup.sh
diff -u misc/host/rblookup.sh:1.2 misc/host/rblookup.sh:1.5
--- misc/host/rblookup.sh:1.2	Fri Mar 21 14:11:02 2003
+++ misc/host/rblookup.sh	Wed May 21 17:35:58 2003
@@ -1,21 +1,27 @@
 #! /bin/sh
 #
-#	@(#)rblookup            e07@nikhef.nl (Eric Wassenaar) 990127
+#ident "@(#)host:HOST-20030527:rblookup.sh,v 1.5 2003/05/21 21:35:58 woods Exp"
+#
+# rblookup - Lookup a dotted quad IP address, or hostname in one of many
+#		Reverse/Realtime DNS-based Lists
 #
 # Author:	E.Wassenaar, Nikhef-H
-# Version:	11-NOV-1997
-# Revision:	02-NOV-1998, Select MAPS (default) or alternatively ORBS
-# Revision:	07-NOV-1998, Anticipate hosts with multiple addresses
-# Revision:	27-JAN-1999, ORBS has moved to a new site
+#
+# Originally from:
+#	@(#)rblookup            e07@nikhef.nl (Eric Wassenaar) 990127
 #
 # Ongoing maintenance by Greg A. Woods <woods@planix.com>
 #
-#ident "@(#)host:HOST-20030405:rblookup.sh,v 1.2 2003/03/21 19:11:02 woods Exp"
+# Usage:
 #
-# Lookup a dotted quad IP address, or hostname in one of many
-# Reverse/Realtime Blackhole Lists
+#	rblookup [-Mdv] [-r rbl_list] hostname|IP#
 #
-#	Syntax:
+#		-M		- include the MAPS zones
+#		-r rbl_list	- use the specified RBLs
+#		-d 		- for debugging
+#		-v		- verbose output (show each RBL)
+#
+#	Operand Syntax:
 #		rblookup hostname ...
 #		rblookup dottedquad ...
 #		rblookup x.x.x.x.in-addr.arpa ...
@@ -24,7 +30,7 @@
 #		zero if the given host was found on the blacklist.
 #		nonzero if not, or if undetermined.
 #
-# The RBLs, or sometimes just DNS Black Lists (DNSBLs) are on-line,
+# The RBLs, or DNS Black/White Lists (DNS[BW]Ls) are on-line,
 # dynamically updated databases of spam hosts, maintained via the DNS.
 # The search key is the reversed dotted quad IP address of the given
 # host, within the zone of the RBL, for example "rbl.mail-abuse.com".
@@ -35,8 +41,9 @@
 # query for a TXT resource record.
 #
 # This script is just an example of a quick and dirty wrapper for the
-# ``host'' utility.  The technique can relatively easy be integrated
-# into MTA programs like sendmail.
+# ``host'' utility.  The technique it uses to check addresses can also
+# be relatively easily integrated into MTA programs like Smail, Exim,
+# Postrix, Sendmail, and so on.
 #
 # TODO:
 #
@@ -63,7 +70,7 @@
 
 argv0=$(basename $0)
 
-options="[-dv] [-r rbl_list]"
+options="[-Mdv] [-r rbl_list]"
 usage="Usage: $argv0 $options hostname|IP# ..."
 reversed=""
 
@@ -76,13 +83,29 @@
 #
 #	http://www.declude.com/junkmail/support/ip4r.htm
 #
-#	http://www.iki.fi/era/rbl/rbl.html	# very dated 2001/12/02
+#	http://moensted.dk/spam/	# less info, but also comprehensive
 #
-#	http://relays.osirusoft.com/cgi-bin/rbcheck.cgi
+#	http://relays.osirusoft.com/cgi-bin/rbcheck.cgi	# has a test interface
 #
-# some published stats by one user of many DNS Black Lists.
+#	http://openrbl.org/zones/	# incomplete, very little info, but has
+#					# an on-line test interface.
+#
+#	http://www.rbls.org/	# complete, but just a list and an on-line test
+#				# interface, no commentary.
+#
+#	http://www.iki.fi/era/rbl/rbl.html	# very dated 2001/12/02
+#
+# some published stats by some users of DNS Black Lists.
 #
 #	http://www.sdsc.edu/~jeff/spam/Blacklists_Compared.html
+#	http://mail.vene.ws/cgi-bin/stats.pl?blacklist
+#	http://abuse.easynet.nl/spamstats.html
+#	http://basic.wirehub.nl/reports/
+#
+# more stats of some kind:
+#
+#	http://openrbl.org/stats.htm
+#
 
 # MAPS RBL: Mail Abuse Protection System Realtime Blackhole List
 # <URL:http://mail-abuse.org/rbl/>
@@ -91,8 +114,8 @@
 # blacklists of spam-originating systems.  Originally started by Paul
 # Vixie, this is the original "RBL" system.  Now a pay-for service.
 #
-MAPS_ROOT="blackholes.mail-abuse.org"
-ALL_RBLS="${MAPS_ROOT} ${ALL_RBLS}"
+MAPS_BLACKHOLES_ROOT="blackholes.mail-abuse.org"
+#ALL_RBLS="${MAPS_ROOT} ${ALL_RBLS}"
 
 # MAPS DUL: Mail Abuse Protection System Dial-up User List
 # <URL:http://mail-abuse.org/dul/>
@@ -104,8 +127,8 @@
 # Al Iverson, the then-current DUL maintainer, to host it on their
 # systems.  Now a pay-for service.
 # 
-DUL_ROOT="dialups.mail-abuse.org"
-ALL_RBLS="${DUL_ROOT} ${ALL_RBLS}"
+MAPS_DUL_ROOT="dialups.mail-abuse.org"
+#ALL_RBLS="${DUL_ROOT} ${ALL_RBLS}"
 
 # MAPS RSS: MAPS Relay Spam Stopper
 # <URL:http://mail-abuse.org/rss/>
@@ -116,8 +139,8 @@
 # relays (and thus miss a vast number of the actively exploited
 # systems out there).  Now a pay-for service.
 #
-RSS_ROOT="relays.mail-abuse.org"
-ALL_RBLS="${RSS_ROOT} ${ALL_RBLS}"
+MAPS_RSS_ROOT="relays.mail-abuse.org"
+#ALL_RBLS="${RSS_ROOT} ${ALL_RBLS}"
 
 # ORBL: Open Relay Black List
 # <URL:http://www.orbl.org/>
@@ -187,43 +210,43 @@
 # Osirusoft Open Relay Spam Stopper
 # <URL:http://relays.osirusoft.com/>
 #
-#     * 127.0.0.2 Verified Open Relay                                            
-#     * 127.0.0.3 Dialup Spam Source                                             
-#       Dialup Spam Sources are imported into the Zone file from other sources   
-#       and some known sources are manually added to the local include file.     
-#     * 127.0.0.4 Confirmed Spam Source                                          
-#       A site has been identified as a constant source of spam, and is          
-#       manually added. Submissions for this type of spam require multiple       
-#       nominations from multiple sites. Test Blockers also find themselves in   
-#       this catagory.                                                           
-#     * 127.0.0.5 Smart Host (In progress)                                       
-#       A Smart host is a site determined to be secure, but relays for those     
-#       who are not, defeating one level of security. When this is ready, it     
-#       will be labeled outputs.osirusoft.com. NOTE: I strongly discourage       
-#       using outputs due to it being way too effective to be useful.            
-#     * 127.0.0.6 A Spamware software developer or spamvertized site. This       
-#       information is maintained by spamsites.org and spamhaus.org.             
-#     * 127.0.0.7 A list server that automatically opts users in without         
-#       confirmation                                                             
-#     * 127.0.0.8 An insecure formmail.cgi script. (Planned)                     
-#     * 127.0.0.9 Open proxy servers                                             
-#
-#     * Relays.OsiruSoft.com contains all zones, except for outputs and          
-#       blocktest. Effectively, it*s the master list containing the minimum      
-#       casualties subzones.                                                     
-#     * Inputs.relays.OsiruSoft.com contains only insecure mail servers.         
-#     * Dialups.relays.OsiruSoft.com contains only sources of direct-to-mx       
-#       spam which are obviously in dynamic IP pools.                            
-#     * Spamsites.relays.OsiruSoft.com contains only sites from spamsites.org.   
-#     * Spamhaus.relays.OsiruSoft.com contains only sites from spamhaus.org.     
-#     * Spews.relays.OsiruSoft.com contains only sites from spews.org.           
-#     * Blocktest.relays.osirusoft.com is a stand-alone zone. It's meant to      
-#       block testers from testing a site or netblock for many different         
-#       reasons and has no practical value. It*s not to be interpreted any       
-#       other way than to prevent test software from testing other sites.        
-#     * Outputs.relays.osirusoft.com will also be a stand-alone zone, and even   
-#       though it will be created, it should only be used to warn the servers    
-#       listed.                                                                  
+#     * 127.0.0.2 Verified Open Relay
+#     * 127.0.0.3 Dialup Spam Source
+#       Dialup Spam Sources are imported into the Zone file from other sources
+#       and some known sources are manually added to the local include file.
+#     * 127.0.0.4 Confirmed Spam Source
+#       A site has been identified as a constant source of spam, and is
+#       manually added. Submissions for this type of spam require multiple
+#       nominations from multiple sites. Test Blockers also find themselves in
+#       this catagory.
+#     * 127.0.0.5 Smart Host (In progress)
+#       A Smart host is a site determined to be secure, but relays for those
+#       who are not, defeating one level of security. When this is ready, it
+#       will be labeled outputs.osirusoft.com. NOTE: I strongly discourage
+#       using outputs due to it being way too effective to be useful.
+#     * 127.0.0.6 A Spamware software developer or spamvertized site. This
+#       information is maintained by spamsites.org and spamhaus.org.
+#     * 127.0.0.7 A list server that automatically opts users in without
+#       confirmation
+#     * 127.0.0.8 An insecure formmail.cgi script. (Planned)
+#     * 127.0.0.9 Open proxy servers
+#
+#     * Relays.OsiruSoft.com contains all zones, except for outputs and
+#       blocktest. Effectively, it*s the master list containing the minimum
+#       casualties subzones.
+#     * Inputs.relays.OsiruSoft.com contains only insecure mail servers.
+#     * Dialups.relays.OsiruSoft.com contains only sources of direct-to-mx
+#       spam which are obviously in dynamic IP pools.
+#     * Spamsites.relays.OsiruSoft.com contains only sites from spamsites.org.
+#     * Spamhaus.relays.OsiruSoft.com contains only sites from spamhaus.org.
+#     * Spews.relays.OsiruSoft.com contains only sites from spews.org.
+#     * Blocktest.relays.osirusoft.com is a stand-alone zone.  It's meant to
+#       block testers from testing a site or netblock for many different
+#       reasons and has no practical value. It*s not to be interpreted any
+#       other way than to prevent test software from testing other sites.
+#     * Outputs.relays.osirusoft.com will also be a stand-alone zone, and even
+#       though it will be created, it should only be used to warn the servers
+#       listed.
 #
 OSIRUSOFT_ROOT="relays.osirusoft.com"
 BLOCKTEST_OSIRUSOFT_ROOT="blocktest.${OSIRUSOFT_ROOT}"
@@ -303,6 +326,10 @@
 #
 # 127.0.0.2	lists open relays and known spam sources
 # 127.0.0.3	lists dial-up addresses
+# 127.0.0.4	lists spam sources
+# 127.0.0.5	lists multi-stage open relays
+# 127.0.0.8	lists servers with insecure formmail scripts
+# 127.0.0.9	lists open proxy sources
 #
 NJABL_ROOT="dnsbl.njabl.org"
 ALL_RBLS="${NJABL_ROOT} ${ALL_RBLS}"
@@ -326,14 +353,12 @@
 # automatically de-list after 90 days.  Apparently they'll gladly
 # remove any listing on request too.
 #
-VISI_ROOT="relays.visi.com"
-ALL_RBLS="${VISI_ROOT} ${ALL_RBLS}"
-
-# xbl.selwerd.cx spam List
-# <URL:http://selwerd.cx/xbl/>
+# Not functional since since 2002/12/16.  They are apparently planning
+# to re-write their software and database and start up again sometime
+# in the future.
 #
-XBL_ROOT="xbl.selwerd.cx"
-ALL_RBLS="${XBL_ROOT} ${ALL_RBLS}"
+#VISI_ROOT="relays.visi.com"
+#ALL_RBLS="${VISI_ROOT} ${ALL_RBLS}"
 
 # spambag.org spam List
 # <URL:http://www.spambag.org/>
@@ -359,24 +384,74 @@
 #SUMMIT_ROOT="blackholes.s2mbit.com"
 #ALL_RBLS="${SUMMIT_ROOT} ${ALL_RBLS}"
 
-# WireHub.nl lists
-# <URL:http://basic.wirehub.nl/spamstats.html>
+# Easynet.nl (formerly WireHub.nl) lists
+# <URL:http://abuse.easynet.nl/blackholes.html>
+# AUP at <URL:http://www.nl.easynet.net/pub/av/en/>
+#
+#     * Easynet DynaBlocker (dynamic IP ranges; a lot of
+#       spam comes straight from dial-up users)
+#
+#	<URL:http://dynablock.easynet.nl/>
+#
+EASYNET_DYNABLOCK_ROOT="dynablock.easynet.nl"
+ALL_RBLS="${EASYNET_DYNABLOCK_ROOT} ${ALL_RBLS}"
+#
+#     * Easynet DNSBL (IPs of persistent spammers, open
+#       relay scanners & abusers, spamvertized websites)
+#
+#	<URL:http://blackholes.easynet.nl/>
+#
+EASYNET_BLACKHOLES_ROOT="blackholes.easynet.nl"
+ALL_RBLS="${EASYNET_BLACKHOLES_ROOT} ${ALL_RBLS}"
+#
+#     * Easynet Proxies (IPs of open proxies)
+#
+#	<URL:http://proxies.blackholes.easynet.nl/>
+#
+EASYNET_PROXIES_ROOT="proxies.blackholes.easynet.nl"
+ALL_RBLS="${EASYNET_PROXIES_ROOT} ${ALL_RBLS}"
+
+# Blitzed Open Proxy Monitor List
+# <URL:http://opm.blitzed.org/info>
 #
-#     * Wirehub DynaBlocker (dynamic IP ranges; a lot of                                                              
-#       spam comes straight from dial-up users)                                                                       
+#   WinGate      127.1.0.1
+#   SOCKS        127.1.0.2
+#   HTTP CONNECT 127.1.0.4
+#   Router       127.1.0.8
+#   HTTP POST    127.1.0.16
 #
-#	<URL:http://basic.wirehub.nl/dynablocker.html>
+BLITZED_ALL_ROOT="opm.blitzed.org"
+ALL_RBLS="${BLITZED_ALL_ROOT} ${ALL_RBLS}"
+
+# reynolds boycott list
+# <URL:http://bl.reynolds.net.au/>
 #
-WIREHUB_DYNABLOCK_ROOT="dynablock.wirehub.net"
-ALL_RBLS="${WIREHUB_DYNABLOCK_ROOT} ${ALL_RBLS}"
+# ``comprises everything of "type 1", which is everything''
 #
-#     * Wirehub DNSBL (IPs of persistent spammers, open                                                               
-#       relay scanners & abusers, spamvertized websites)                                                              
+REYNOLDS_T1_BL_ROOT="t1.bl.reynolds.net.au"
+ALL_RBLS="${REYNOLDS_T1_BL_ROOT} ${ALL_RBLS}"
+
+# Spamhaus Block List
+# <URL:http://www.spamhaus.org/sbl/index.lasso>
+#
+# verified spam sources
+#
+SPAMHAUS_BL_ROOT="sbl.spamhaus.org"
+ALL_RBLS="${SPAMHAUS_BL_ROOT} ${ALL_RBLS}"
+
+# SORBS: Spam and Open Relay Blocking System
+# <URL:http://www.dnsbl.sorbs.net/>
 #
-#	<URL:http://basic.wirehub.nl/blackholes.html>
+# 127.0.0.2	- open HTTP proxies
+# 127.0.0.3	- open SOCKS proxies
+# 127.0.0.4	- misc proxies
+# 127.0.0.5	- open relays
+# 127.0.0.6	- sent spam to sorbs.net
+# 127.0.0.7	- vulnerable web servers
+# 127.0.0.9	- hijacked networks
 #
-WIREHUB_BLACKHOLES_ROOT="blackholes.wirehub.net"
-ALL_RBLS="${WIREHUB_BLACKHOLES_ROOT} ${ALL_RBLS}"
+SORBS_ROOT="dnsbl.sorbs.net"
+ALL_RBLS="${SORBS_ROOT} ${ALL_RBLS}"
 
 # ----------------------------------------------------------------------
 # Exit codes from <sysexits.h>, just in case we are called from a mailer
@@ -406,6 +481,9 @@
 
 for i in ${1+$@}; do
 	case "$i" in
+	-M)
+		ALL_RBLS="${MAPS_BLACKHOLES_ROOT} ${MAPS_DUL_ROOT} ${MAPS_RSS_ROOT} ${ALL_RBLS}"
+		;;
 	-d)
 		show_or_exec=echo
 		;;
Index: misc/host/send.c
diff -u misc/host/send.c:1.13 misc/host/send.c:1.15
--- misc/host/send.c:1.13	Sat Apr  5 22:10:44 2003
+++ misc/host/send.c	Fri May 16 20:53:24 2003
@@ -17,7 +17,7 @@
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ident "@(#)host:HOST-20030405:send.c,v 1.13 2003/04/06 03:10:44 woods Exp"
+#ident "@(#)host:HOST-20030527:send.c,v 1.15 2003/05/17 00:53:24 woods Exp"
 
 #if 0
 static char Version[] = "@(#)send.c	e07@nikhef.nl (Eric Wassenaar) 991331";
@@ -32,7 +32,7 @@
 int minport = 0;		/* first source port in explicit range */
 int maxport = 0;		/* last  source port in explicit range */
 
-unsigned int timeout;		/* connection read timeout */
+static unsigned int conn_timeout;	/* connection read timeout */
 
 static struct sockaddr_in from;	/* address of inbound packet */
 static struct sockaddr *from_sa = (struct sockaddr *) &from;
@@ -41,6 +41,16 @@
 
 static int srvsock = -1;	/* socket descriptor */
 
+#if !defined(NO_CONNECTED_DGRAM)
+static bool_t connected = TRUE;   /* we can use connected datagram sockets */
+#else
+static bool_t connected = FALSE;  /* connected datagram sockets unavailable */
+#endif
+
+static bool_t check_from __P((void));
+static int send_stream	__P((struct sockaddr_in *, const qbuf_t *, size_t, qbuf_t *, size_t));
+static int send_dgram	__P((struct sockaddr_in *, const qbuf_t *, size_t, qbuf_t *, size_t));
+
 /*
 ** RES_SEND -- Send nameserver query and retrieve answer
 ** -----------------------------------------------------
@@ -119,17 +129,17 @@
 				try = _res.retry;
 
 				/* connect via virtual circuit */
-				n = send_stream(addr, query, querylen, answer, anslen);
+				n = send_stream(addr, query, (size_t) querylen, answer, (size_t) anslen);
 			} else {
 				/* set datagram read timeout for recv_sock() */
-				timeout = (_res.retrans << try);
+				conn_timeout = (_res.retrans << try);
 				if (try > 0)
-					timeout /= _res.nscount;
-				if (timeout <= 0)
-					timeout = 1;
+					conn_timeout /= _res.nscount;
+				if (conn_timeout <= 0)
+					conn_timeout = 1;
 
 				/* connect via datagram */
-				n = send_dgram(addr, query, querylen, answer, anslen);
+				n = send_dgram(addr, query, (size_t) querylen, answer, (size_t) anslen);
 
 				/* check truncation; use v_circuit with same server */
 				if ((n > 0) && bp->tc) {
@@ -228,14 +238,14 @@
 static int
 send_stream(addr, query, querylen, answer, anslen)
 	input struct sockaddr_in *addr;	/* the server address to connect to */
-	input qbuf_t *query;		/* location of formatted query buffer */
-	input int querylen;		/* length of query buffer */
+	input const qbuf_t *query;	/* location of formatted query buffer */
+	input size_t querylen;		/* length of query buffer */
 	output qbuf_t *answer;		/* location of buffer to store answer */
-	input int anslen;		/* maximum size of answer buffer */
+	input size_t anslen;		/* maximum size of answer buffer */
 {
 	char *host = NULL;		/* name of server is unknown */
-	HEADER *qp = (HEADER *) query;
-	HEADER *bp = (HEADER *) answer;
+	const HEADER *qp = (const HEADER *) query;
+	const HEADER *bp = (const HEADER *) answer;
 	register int n;
 
 	/*
@@ -259,7 +269,7 @@
 	/*
 	 * Send the query buffer.
 	 */
-	if (host_res_write(srvsock, addr, host, (char *) query, querylen) < 0) {
+	if (host_res_write(srvsock, addr, host, (const char *) query, (size_t) querylen) < 0) {
 		(void) host_res_close(srvsock);
 		return (-1);
 	}
@@ -268,7 +278,7 @@
 	 * Read the answer buffer.
 	 */
 wait:
-	if ((n = host_res_read(srvsock, addr, host, (char *) answer, anslen, 0)) < 0) {
+	if ((n = host_res_read(srvsock, addr, host, (char *) answer, (size_t) anslen)) < 0) {
 		(void) host_res_close(srvsock);
 		return (-1);
 	}
@@ -279,7 +289,7 @@
 	if (qp->id != bp->id) {
 		if (bitset(RES_DEBUG, _res.options)) {
 			printf("%sunexpected answer:\n", debug_prefix);
-			pr_query(answer, (n > anslen) ? anslen : n, stdout);
+			pr_query(answer, ((size_t) n > anslen) ? (int) anslen : n, stdout);
 		}
 		goto wait;
 	}
@@ -301,7 +311,7 @@
 **		-1 if an error occurred.
 **
 **	Inputs:
-**		The global variable ``timeout'' should have been
+**		The global variable ``conn_timeout'' should have been
 **		set with the desired timeout value in seconds.
 **
 **	Sending to a nameserver datagram port with no nameserver running
@@ -319,14 +329,14 @@
 static int
 send_dgram(addr, query, querylen, answer, anslen)
 	input struct sockaddr_in *addr;	/* the server address to connect to */
-	input qbuf_t *query;		/* location of formatted query buffer */
-	input int querylen;		/* length of query buffer */
+	input const qbuf_t *query;	/* location of formatted query buffer */
+	input size_t querylen;		/* length of query buffer */
 	output qbuf_t *answer;		/* location of buffer to store answer */
-	input int anslen;		/* maximum size of answer buffer */
+	input size_t anslen;		/* maximum size of answer buffer */
 {
 	char *host = NULL;		/* name of server is unknown */
-	HEADER *qp = (HEADER *) query;
-	HEADER *bp = (HEADER *) answer;
+	const HEADER *qp = (const HEADER *) query;
+	const HEADER *bp = (const HEADER *) answer;
 	register int n;
 
 	/*
@@ -348,12 +358,12 @@
 	 * Send the query buffer.
 	 */
 	if (connected)
-		n = send(srvsock, (char *) query, querylen, 0);
+		n = send(srvsock, (const ptr_t *) query, querylen, 0);
 	else
-		n = sendto(srvsock, (char *) query, querylen, 0,
+		n = sendto(srvsock, (const ptr_t *) query, querylen, 0,
 			   (struct sockaddr *) addr, sizeof(*addr));
 
-	if (n != querylen) {
+	if ((size_t) n != querylen) {
 		if (bitset(RES_DEBUG, _res.options))
 			host_res_perror(addr, host, "send");
 		(void) host_res_close(srvsock);
@@ -377,7 +387,7 @@
 	if (qp->id != bp->id) {
 		if (bitset(RES_DEBUG, _res.options))  {
 			printf("%sold answer:\n", debug_prefix);
-			pr_query(answer, (n > anslen) ? anslen : n, stdout);
+			pr_query(answer, ((size_t) n > anslen) ? (int) anslen : n, stdout);
 		}
 		goto wait;
 	}
@@ -389,7 +399,7 @@
 		if (bitset(RES_DEBUG, _res.options)) {
 			printf("%sunknown server %s:\n",
 				debug_prefix, inet_ntoa(from.sin_addr));
-			pr_query(answer, (n > anslen) ? anslen : n, stdout);
+			pr_query(answer, ((size_t) n > anslen) ? (int) anslen : n, stdout);
 		}
 		goto wait;
 	}
@@ -612,7 +622,7 @@
 	input int sock;			/* socket FD to write to */
 	input struct sockaddr_in *addr;	/* the server address to connect to */
 	input char *host;		/* name of server to connect to */
-	input char *buf;		/* location of formatted query buffer */
+	input const char *buf;		/* location of formatted query buffer */
 	input size_t bufsize;		/* length of query buffer */
 {
 	u_int len;
@@ -689,7 +699,7 @@
 	register int n;
 
 	/* set stream timeout for recv_sock() */
-	timeout = READTIMEOUT;
+	conn_timeout = READTIMEOUT;
 
 	/*
 	 * Read the length of answer buffer.
@@ -800,7 +810,7 @@
 	register int n;
 
 	/* set stream timeout for recv_sock() */
-	timeout = READTIMEOUT;
+	conn_timeout = READTIMEOUT;
 
 	/*
 	 * Read more of the answer itself.
@@ -829,7 +839,7 @@
 **		Length of buffer if successfully received.
 **		-1 in case of failure or timeout.
 **	Inputs:
-**		The global variable ``timeout'' should have been
+**		The global variable ``conn_timeout'' should have been
 **		set with the desired timeout value in seconds.
 **	Outputs:
 **		Sets ``from'' to the address of the packet sender.
@@ -846,7 +856,7 @@
 	socklen_t fromlen;
 	register int n;
 
-	wait.tv_sec = timeout;
+	wait.tv_sec = conn_timeout;
 	wait.tv_usec = 0;
 rewait:
 	/* FD_ZERO(&fds); */
@@ -905,7 +915,7 @@
 	}
 
 	setsignal(SIGALRM, timer);
-	setalarm(timeout);
+	setalarm(conn_timeout);
 reread:
 	/* fake an error if nothing was actually read */
 	fromlen = sizeof(from);
Index: misc/host/test.c
diff -u misc/host/test.c:1.5 misc/host/test.c:1.6
--- misc/host/test.c:1.5	Mon Mar 31 16:04:22 2003
+++ misc/host/test.c	Wed Apr  9 02:09:08 2003
@@ -17,7 +17,7 @@
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ident "@(#)host:HOST-20030405:test.c,v 1.5 2003/03/31 21:04:22 woods Exp"
+#ident "@(#)host:HOST-20030527:test.c,v 1.6 2003/04/09 06:09:08 woods Exp"
 
 #if 0
 static char Version[] = "@(#)test.c	e07@nikhef.nl (Eric Wassenaar) 991515";
@@ -38,8 +38,8 @@
 /*ARGSUSED*/
 bool_t
 test(name, addr)
-	input char *name;		/* name to query about */
-	input ipaddr_t addr;		/* explicit address of query */
+	input char *name;		/* UNUSED name to query about */
+	input ipaddr_t addr;		/* UNUSED explicit address of query */
 {
 	return (TRUE);
 }
