--- old/usr/src/lib/libresolv/Makefile	Thu Jul  9 15:59:30 2015
+++ new/usr/src/lib/libresolv/Makefile	Thu Jul  9 15:59:30 2015
@@ -19,6 +19,7 @@
 # CDDL HEADER END
 #
 #
+# Copyright 2015 Gary Mills
 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
@@ -54,13 +55,10 @@
 # so we must put -I. ahead of the default include directories:
 CPPFLAGS = -I. -I../common/inc $(CPPFLAGS.master) -DDEBUG -DSYSV -D_REENTRANT
 LDLIBS += -lsocket -lnsl -lc
+CFLAGS += $(CCVERBOSE)
 
-CERRWARN += -_gcc=-Wno-implicit-function-declaration
 CERRWARN += -_gcc=-Wno-parentheses
-CERRWARN += -_gcc=-Wno-unused-variable
 CERRWARN += -_gcc=-Wno-uninitialized
-CERRWARN += -_gcc=-Wno-implicit-int
-CERRWARN += -_gcc=-Wno-extra
 
 ROOTDYNLIBS=	$(DYNLIB:%=$(ROOTLIBDIR)/%)
 
--- /dev/null	Thu Jul  9 15:59:30 2015
+++ new/usr/src/lib/libresolv/crossl.h	Thu Jul  9 15:59:31 2015
@@ -0,0 +1,61 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2015 Gary Mills
+ */
+
+#ifndef _CROSSL_H
+#define	_CROSSL_H
+
+/*
+ * Definitions needed for cross-linkages between source files
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int
+dn_comp(u_char *, u_char *, int, u_char **, u_char **);
+extern int
+dn_expand(u_char *, u_char *, u_char *, u_char *, int);
+extern int
+dn_skipname(u_char *, u_char *);
+
+extern int
+res_init(void);
+extern int
+res_mkquery(int, char *, int, int, char *, int, struct rrec *, char *, int);
+extern int
+res_query(char *, int, int, u_char *, int);
+extern int
+res_querydomain(char *, char *, int, int, u_char *, int);
+extern int
+res_search(char *, int, int, u_char *, int);
+extern int
+res_send(char *, int, char *, int);
+
+extern void
+putlong(u_long, u_char *);
+extern void
+putshort(u_short, u_char *);
+extern void
+p_query(char *);
+extern void
+_res_close();
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CROSSL_H */
--- old/usr/src/lib/libresolv/res_debug.c	Thu Jul  9 15:59:31 2015
+++ new/usr/src/lib/libresolv/res_debug.c	Thu Jul  9 15:59:31 2015
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright 2015 Gary Mills
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -37,15 +38,16 @@
  * contributors.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
+#include <sys/socket.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 #include <stdio.h>
+#include <string.h>
 #include <arpa/nameser.h>
+#include <resolv.h>
+#include "crossl.h"
 
-extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time();
-extern char *inet_ntoa();
 void fp_query(char *msg, FILE *file);
 
 char *_res_opcodes[] = {
@@ -195,7 +197,8 @@
 	char name[MAXDNAME];
 	int n;
 
-	if ((n = dn_expand(msg, msg + 512, cp, name, sizeof (name))) < 0)
+	if ((n = dn_expand((u_char *)msg, (u_char *)(msg + 512), (u_char *)cp,
+	    (u_char *)name, sizeof (name))) < 0)
 		return (NULL);
 	if (name[0] == '\0') {
 		name[0] = '.';
--- old/usr/src/lib/libresolv/res_gethost.c	Thu Jul  9 15:59:31 2015
+++ new/usr/src/lib/libresolv/res_gethost.c	Thu Jul  9 15:59:31 2015
@@ -1,4 +1,5 @@
 /*
+ * Copyright 2015 Gary Mills
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -23,10 +24,12 @@
 #include <netdb.h>
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
 #include <syslog.h>
+#include "crossl.h"
 
 /*
  * When the name service switch calls libresolv, it doesn't want fallback
@@ -103,8 +106,8 @@
 	cp = answer->buf + sizeof (HEADER);
 	if (qdcount) {
 		if (iquery) {
-			if ((n = dn_expand((char *)answer->buf, eom,
-						cp, bp, buflen)) < 0) {
+			if ((n = dn_expand(answer->buf, eom,
+			    cp, (u_char *)bp, buflen)) < 0) {
 				h_errno = NO_RECOVERY;
 				return ((struct hostent *) NULL);
 			}
@@ -132,8 +135,8 @@
 #endif
 	haveanswer = 0;
 	while (--ancount >= 0 && cp < eom && haveanswer < MAXADDRS) {
-		if ((n = dn_expand((char *)answer->buf, eom,
-						cp, bp, buflen)) < 0)
+		if ((n = dn_expand(answer->buf, eom,
+		    cp, (u_char *)bp, buflen)) < 0)
 			break;
 		cp += n;
 		type = _getshort(cp);
@@ -153,8 +156,8 @@
 			continue;
 		}
 		if (iquery && type == T_PTR) {
-			if ((n = dn_expand((char *)answer->buf, eom,
-					cp, bp, buflen)) < 0) {
+			if ((n = dn_expand(answer->buf, eom,
+			    cp, (u_char *)bp, buflen)) < 0) {
 				cp += n;
 				continue;
 			}
@@ -231,7 +234,6 @@
 	querybuf buf;
 	register char *cp;
 	int n;
-	struct hostent *hp, *gethostdomain();
 
 	/*
 	 * disallow names consisting only of digits/dots, unless
@@ -281,7 +283,7 @@
 		((unsigned)addr[2] & 0xff),
 		((unsigned)addr[1] & 0xff),
 		((unsigned)addr[0] & 0xff));
-	n = res_query(qbuf, C_IN, T_PTR, (char *)&buf, sizeof (buf));
+	n = res_query(qbuf, C_IN, T_PTR, (u_char *)&buf, sizeof (buf));
 	if (n < 0) {
 #ifdef DEBUG
 		if (_res.options & RES_DEBUG)
--- old/usr/src/lib/libresolv/res_init.c	Thu Jul  9 15:59:31 2015
+++ new/usr/src/lib/libresolv/res_init.c	Thu Jul  9 15:59:31 2015
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright 2015 Gary Mills
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -37,13 +38,15 @@
  * contributors.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/sockio.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stropts.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
 
@@ -52,6 +55,12 @@
 #include <netinet/if_ether.h>
 #include <arpa/inet.h>
 
+/*
+ * Undocumented external function in libnsl
+ */
+extern int
+getdomainname(char *, int);
+
 #define	MAXIFS	256
 
 /*
@@ -87,13 +96,6 @@
 	register char *cp, **pp;
 	register int n;
 	char buf[BUFSIZ];
-#ifdef SYSV
-	extern char *strchr();
-#else
-	extern char *index();
-#endif
-	extern char *strcpy(), *strncpy();
-	extern char *getenv();
 	int nserv = 0;    /* number of nameserver records read from file */
 	int haveenv = 0;
 	int havesearch = 0;
@@ -111,7 +113,6 @@
 		unsigned bufsize;
 		unsigned int flags;
 		char *buf;
-		extern void *malloc();
 
 		if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
 			perror("socket");
@@ -124,7 +125,7 @@
 		buf = (char *)malloc(bufsize);
 		if (buf == NULL) {
 			perror("out of memory");
-			close(s);
+			(void) close(s);
 			return (-1);
 		}
 		ifc.ifc_len = bufsize;
@@ -131,7 +132,7 @@
 		ifc.ifc_buf = buf;
 		if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) {
 			perror("ifconfig: SIOCGIFCONF");
-			close(s);
+			(void) close(s);
 			free(buf);
 			return (-1);
 		}
@@ -140,12 +141,12 @@
 		ifrp = ifc.ifc_req;
 		for (n = ifc.ifc_len / sizeof (struct ifreq); n > 0;
 								n--, ifrp++) {
-			memset((void *) &ifr, 0, sizeof (ifr));
+			(void) memset((void *) &ifr, 0, sizeof (ifr));
 			strncpy(ifr.ifr_name, ifrp->ifr_name,
 							sizeof (ifr.ifr_name));
 			if (ioctl(s, SIOCGIFFLAGS, (char *)&ifr) < 0) {
 				perror("SIOCGIFFLAGS");
-				close(s);
+				(void) close(s);
 				free(buf);
 				return (-1);
 			}
@@ -154,7 +155,7 @@
 			if ((flags & IFF_UP) && ((flags & IFF_LOOPBACK) == 0))
 				int_up = 1;
 		}
-		close(s);
+		(void) close(s);
 		free(buf);
 		if (int_up == 0) /* all the non-LOOPBACK interfaces are DOWN */
 			return (-1);
@@ -166,9 +167,9 @@
 	 * for the benefit of hidden NIS domains, we use the same procedure
 	 * as sendmail: convert leading + to dot, then drop to first dot
 	 */
-	getdomainname(buf, BUFSIZ);
+	(void) getdomainname(buf, BUFSIZ);
 	if (buf[0] == '+')
-	buf[0] = '.';
+		buf[0] = '.';
 #ifdef SYSV
 	cp = strchr(buf, (int)'.');
 #else
--- old/usr/src/lib/libresolv/res_mkquery.c	Thu Jul  9 15:59:31 2015
+++ new/usr/src/lib/libresolv/res_mkquery.c	Thu Jul  9 15:59:31 2015
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright 2015 Gary Mills
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -37,8 +38,6 @@
  * contributors.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -46,8 +45,12 @@
 #include <netinet/in.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <errno.h>
 #include <netdb.h>
+#include "crossl.h"
 
 /*
  * Kludge to time out quickly if there is no /etc/resolv.conf
@@ -97,11 +100,11 @@
 			ns_sin.sin_port = htons(NAMESERVER_PORT);
 			if (connect(ns, (struct sockaddr *) &ns_sin,
 				    sizeof ns_sin) == -1) {
-				close(ns);
+				(void) close(ns);
 				return(-1);
 			}
 			else {
-				close(ns);
+				(void) close(ns);
 				return(0);
 			}
 		}
@@ -128,9 +131,9 @@
 	int buflen;		/* size of buffer */
 {
 	register HEADER *hp;
-	register char *cp;
+	register u_char *cp;
 	register int n;
-	char *dnptrs[10], **dpp, **lastdnptr;
+	u_char *dnptrs[10], **dpp, **lastdnptr;
 
 #ifdef DEBUG
 	if (_res.options & RES_DEBUG)
@@ -159,7 +162,7 @@
 	if ((buf == NULL) || (buflen < sizeof (HEADER)))
 		return (-1);
 #ifdef SYSV
-	memset(buf, 0, sizeof (HEADER));
+	(void) memset(buf, 0, sizeof (HEADER));
 #else
 	bzero(buf, sizeof (HEADER));
 #endif
@@ -169,10 +172,10 @@
 	hp->pr = (_res.options & RES_PRIMARY) != 0;
 	hp->rd = (_res.options & RES_RECURSE) != 0;
 	hp->rcode = NOERROR;
-	cp = buf + sizeof (HEADER);
+	cp = (u_char *)(buf + sizeof (HEADER));
 	buflen -= sizeof (HEADER);
 	dpp = dnptrs;
-	*dpp++ = buf;
+	*dpp++ = (u_char *)buf;
 	*dpp++ = NULL;
 	lastdnptr = dnptrs + sizeof (dnptrs) / sizeof (dnptrs[0]);
 	/*
@@ -182,7 +185,8 @@
 	case QUERY:
 		if ((buflen -= QFIXEDSZ) < 0)
 			return (-1);
-		if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
+		if ((n = dn_comp((u_char *)dname, cp, buflen,
+		    dnptrs, lastdnptr)) < 0)
 			return (-1);
 		cp += n;
 		buflen -= n;
@@ -197,7 +201,8 @@
 		 * Make an additional record for completion domain.
 		 */
 		buflen -= RRFIXEDSZ;
-		if ((n = dn_comp(data, cp, buflen, dnptrs, lastdnptr)) < 0)
+		if ((n = dn_comp((u_char *)data, cp, buflen,
+		    dnptrs, lastdnptr)) < 0)
 			return (-1);
 		cp += n;
 		buflen -= n;
@@ -229,7 +234,7 @@
 		cp += sizeof (u_short);
 		if (datalen) {
 #ifdef SYSV
-			memcpy((void *)cp, (void *)data, datalen);
+			(void) memcpy((void *)cp, (void *)data, datalen);
 #else
 			bcopy(data, cp, datalen);
 #endif
@@ -254,7 +259,8 @@
 		 */
 	case UPDATEDA:
 		buflen -= RRFIXEDSZ + datalen;
-		if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
+		if ((n = dn_comp((u_char *)dname, cp, buflen,
+		    dnptrs, lastdnptr)) < 0)
 			return (-1);
 		cp += n;
 		putshort(type, cp);
@@ -281,7 +287,8 @@
 
 	case UPDATEA:	/* Add new resource record */
 		buflen -= RRFIXEDSZ + datalen;
-		if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
+		if ((n = dn_comp((u_char *)dname, cp, buflen,
+		    dnptrs, lastdnptr)) < 0)
 			return (-1);
 		cp += n;
 		putshort(newrr->r_type, cp);
@@ -305,5 +312,5 @@
 
 #endif /* ALLOW_UPDATES */
 	}
-	return (cp - buf);
+	return ((char *)cp - buf);
 }
--- old/usr/src/lib/libresolv/res_query.c	Thu Jul  9 15:59:31 2015
+++ new/usr/src/lib/libresolv/res_query.c	Thu Jul  9 15:59:31 2015
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright 2015 Gary Mills
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -37,8 +38,6 @@
  * contributors.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -47,9 +46,11 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
+#include <stdlib.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
+#include "crossl.h"
 
 #if PACKETSZ > 1024
 #define	MAXPACKET	PACKETSZ
@@ -96,7 +97,7 @@
 		h_errno = NO_RECOVERY;
 		return (n);
 	}
-	n = res_send(buf, n, answer, anslen);
+	n = res_send(buf, n, (char *)answer, anslen);
 	if (n < 0) {
 #ifdef DEBUG
 		if (_res.options & RES_DEBUG)
@@ -271,7 +272,7 @@
 {
 	register char *C1, *C2;
 	FILE *fp;
-	char *file, *getenv(), *strcpy(), *strncpy();
+	char *file;
 	char buf[BUFSIZ];
 	static char abuf[MAXDNAME];
 
--- old/usr/src/lib/libresolv/res_send.c	Thu Jul  9 15:59:31 2015
+++ new/usr/src/lib/libresolv/res_send.c	Thu Jul  9 15:59:31 2015
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright 2015 Gary Mills
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -37,8 +38,6 @@
  * contributors.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * Send query to name server and wait for reply.
  */
@@ -50,13 +49,24 @@
 #include <sys/stat.h>
 #include <netinet/in.h>
 #include <stdio.h>
+#include <string.h>
+#include <unistd.h>
 #include <errno.h>
 #include <arpa/nameser.h>
+#include <arpa/inet.h>
 #include <resolv.h>
+#include "crossl.h"
 
+/*
+ * Undocumented external function in libsocket
+ */
+extern int
+_socket(int, int, int);
 
 static int s = -1;	/* socket used for communications */
+#if	BSD >= 43
 static struct sockaddr no_addr;
+#endif /* BSD */
 
 
 #ifndef FD_SET
@@ -66,7 +76,7 @@
 #define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
 #define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
 #ifdef SYSV
-#define	FD_ZERO(p)	memset((void *)(p), 0, sizeof (*(p)))
+#define	FD_ZERO(p)	(void) memset((void *)(p), 0, sizeof (*(p)))
 #else
 #define	FD_ZERO(p)	bzero((char *)(p), sizeof (*(p)))
 #endif
@@ -129,7 +139,10 @@
 {
 	register int n;
 	int try, v_circuit, resplen, ns;
-	int gotsomewhere = 0, connected = 0;
+	int gotsomewhere = 0;
+#if	BSD >= 43
+	int connected = 0;
+#endif /* BSD */
 	int connreset = 0;
 	u_short id, len;
 	char *cp;
--- old/usr/src/lib/libresolv/res_sethost.c	Thu Jul  9 15:59:32 2015
+++ new/usr/src/lib/libresolv/res_sethost.c	Thu Jul  9 15:59:32 2015
@@ -20,6 +20,7 @@
  */
 
 /*
+ * Copyright 2015 Gary Mills
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -37,15 +38,15 @@
  * contributors.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <arpa/nameser.h>
 #include <netinet/in.h>
 #include <resolv.h>
+#include "crossl.h"
 
 void
 res_sethostent(stayopen)
+int stayopen;
 {
 	if (stayopen)
 		_res.options |= RES_STAYOPEN | RES_USEVC;
