$NetBSD$

--- src/www-con.c.orig	2006-10-06 21:22:43.000000000 +0200
+++ src/www-con.c	2006-10-06 21:23:04.000000000 +0200
@@ -15,6 +15,7 @@
 #include <dirent.h>
 #include <sys/time.h>
 #include <assert.h>
+#include <errno.h>
 
 
 /* From seanm@storm.ca  Fri Dec  8 04:44:43 2000 */
@@ -29,16 +30,15 @@
 #include <stdlib.h>
 #endif
 
-#if defined(NETBSD) || defined(FreeBSD)
+#if defined(NETBSD) || defined(FreeBSD) || defined(__APPLE__)
 #include <sys/filio.h>
+#include <sys/ioctl.h>
 #endif
 
 #ifndef FD_SETSIZE
 #define FD_SETSIZE 256
 #endif
 
-extern int errno;
-
 #include "../libnut/mosaic-types.h"
 #include "../libnut/system.h"
 #include "../libhtmlw/HTML.h"
@@ -225,8 +225,11 @@
 	}
 /* manage only non numeric adresses for IPV6 */
 /* RFC 2133 */
-/*	phost = gethostbyname2 (host,AF_INET6); */
+#if defined(NETBSD)
+	phost = gethostbyname2 (host,AF_INET6);
+#else
 	phost = getipnodebyname( host, AF_INET6, AI_DEFAULT, &err_num);
+#endif
 
 	if (phost) {			/* try IPV6 */
 #ifdef DEBUG_IPV6
@@ -270,9 +273,12 @@
 			if (cached4_host && (strcmp (cached4_host, host) == 0)){
 				memcpy(&sin4->sin_addr, cached4_phost_h_addr, cached4_phost_h_length);
 			} else {
-/*				phost = gethostbyname2 (host,AF_INET); */
-/*				phost = gethostbyname (host); */
+#if defined(NETBSD)
+				phost = gethostbyname2 (host,AF_INET);
+			     /* phost = gethostbyname (host); */
+#else
 				phost = getipnodebyname( host, AF_INET6, AI_DEFAULT, &err_num);
+#endif
 				if (!phost) {
 					fprintf (stderr, "Can't find internet node name `%s'.\n",host);
 					return IN_IPV_UNKNOWN;  /* Fail */
