diff -u whois.dist/whois.1 whois/whois.1
--- whois.dist/whois.1	Sat Jul  7 12:31:15 2001
+++ whois/whois.1	Sat Jul  7 12:25:30 2001
@@ -40,8 +40,9 @@
 .Nd Internet domain name and network number directory service
 .Sh SYNOPSIS
 .Nm
-.Op Fl adgimpQrR6
+.Op Fl adgimpQrRu6
 .Op Fl h Ar host
+.Op Fl P Ar port
 .Ar name ...
 .Sh DESCRIPTION
 .Nm Whois
@@ -114,11 +115,13 @@
 database.
 It contains route policy specifications for a large
 number of operators' networks.
+.It Fl P Ar port
+Specify a port to query.  The default is 43
 .It Fl p
 Use the Asia/Pacific Network Information Center
 .Pq Tn APNIC
-database.  It contains network numbers used in East Asia, Australia,
-New Zealand, and the Pacific islands.
+database.  It contains network numbers used in East Asia, New Zealand,
+and the Pacific islands.
 .It Fl Q
 Do a quick lookup.  This means that
 .Nm
@@ -136,6 +139,10 @@
 database.  It contains network numbers and domain contact information
 for subdomains of
 .Tn \&.RU .
+.It Fl u
+Use the Australia Network Information Center
+.Pq Tn AUNIC
+database.  It contains network numbers used in Australia
 .It Fl 6
 Use the IPv6 Resource Center
 .Pq Tn 6bone
diff -u whois.dist/whois.c whois/whois.c
--- whois.dist/whois.c	Sat Jul  7 12:31:15 2001
+++ whois/whois.c	Sat Jul  7 12:18:41 2001
@@ -56,12 +56,14 @@
 #include <string.h>
 #include <sysexits.h>
 #include <unistd.h>
+#include <ctype.h>
 
 #define	NICHOST		"whois.crsnic.net"
 #define	INICHOST	"whois.networksolutions.com"
 #define	DNICHOST	"whois.nic.mil"
 #define	GNICHOST	"whois.nic.gov"
 #define	ANICHOST	"whois.arin.net"
+#define	AUNICHOST	"whois.aunic.net"
 #define	RNICHOST	"whois.ripe.net"
 #define	PNICHOST	"whois.apnic.net"
 #define	RUNICHOST	"whois.ripn.net"
@@ -75,7 +77,7 @@
 #define WHOIS_QUICK		0x04
 
 static void usage __P((void));
-static void whois __P((char *, struct addrinfo *, int));
+static void whois __P((char *, struct addrinfo *, char *, int));
 
 int
 main(argc, argv)
@@ -84,9 +86,11 @@
 {
 	int ch, i, j, error;
 	int use_qnichost, flags;
+	char *port;
 	char *host;
 	char *qnichost;
 	struct addrinfo hints, *res;
+	struct servent *se;
 
 #ifdef	SOCKS
 	SOCKSinit(argv[0]);
@@ -96,7 +100,8 @@
 	qnichost = NULL;
 	flags = 0;
 	use_qnichost = 0;
-	while ((ch = getopt(argc, argv, "adgh:impQrR6")) != -1) {
+	port = NULL;
+	while ((ch = getopt(argc, argv, "adgh:impP:QrRu6")) != -1) {
 		switch((char)ch) {
 		case 'a':
 			host = ANICHOST;
@@ -116,6 +121,9 @@
 		case 'm':
 			host = MNICHOST;
 			break;
+		case 'P':
+			port = optarg;
+			break;
 		case 'p':
 			host = PNICHOST;
 			break;
@@ -128,6 +136,9 @@
 		case 'R':
 			host = RUNICHOST;
 			break;
+		case 'u':
+			host = AUNICHOST;
+			break;
 		case '6':
 			host = SNICHOST;
 			break;
@@ -154,6 +165,18 @@
 			flags |= WHOIS_INIC_FALLBACK | WHOIS_RECURSE;
 		}
 	}
+	if (port != NULL) {
+		for (i = 0; i < strlen(port); i++) {
+			if (!isdigit(port[i])) {
+				port = NULL;
+				(void)setservent(0);
+				se = getservbyname("whois", "tcp");
+				(void)fprintf(stderr,
+					"Invalid port, defaulting\n");
+				break;
+			}
+		}
+	}
 	while (argc--) {
 		if (use_qnichost) {
 			if (qnichost) {
@@ -178,7 +201,11 @@
 				hints.ai_flags = 0;
 				hints.ai_family = AF_UNSPEC;
 				hints.ai_socktype = SOCK_STREAM;
-				error = getaddrinfo(qnichost, "whois",
+				if (port)
+					error = getaddrinfo(qnichost, port,
+						&hints, &res);
+				else
+					error = getaddrinfo(qnichost, "whois",
 						&hints, &res);
 				if (error != 0)
 					errx(EX_NOHOST, "%s: %s", qnichost,
@@ -190,22 +217,27 @@
 			hints.ai_flags = 0;
 			hints.ai_family = AF_UNSPEC;
 			hints.ai_socktype = SOCK_STREAM;
-			error = getaddrinfo(host, "whois", &hints, &res);
+			if (port)
+				error = getaddrinfo(host, port, &hints, &res);
+			else
+				error = getaddrinfo(host, "whois", &hints,
+					&res);
 			if (error != 0)
 				errx(EX_NOHOST, "%s: %s", host,
 					gai_strerror(error));
 		}
 
-		whois(*argv++, res, flags);
+		whois(*argv++, res, port, flags);
 		freeaddrinfo(res);
 	}
 	exit(0);
 }
 
 static void
-whois(name, res, flags)
+whois(name, res, port, flags)
 	char *name;
 	struct addrinfo *res;
+	char *port;
 	int flags;
 {
 	FILE *sfi, *sfo;
@@ -275,7 +307,10 @@
 		hints.ai_flags = 0;
 		hints.ai_family = AF_UNSPEC;
 		hints.ai_socktype = SOCK_STREAM;
-		error = getaddrinfo(nhost, "whois", &hints, &res2);
+		if (port)
+			error = getaddrinfo(nhost, port, &hints, &res2);
+		else
+			error = getaddrinfo(nhost, "whois", &hints, &res2);
 		if (error != 0) {
 			warnx("%s: %s", nhost, gai_strerror(error));
 			return;
@@ -283,7 +318,7 @@
 		if (!nomatch) {
 			free(nhost);
 		}
-		whois(name, res2, 0);
+		whois(name, res2, port, 0);
 		freeaddrinfo(res2);
 	}
 }
@@ -292,6 +327,6 @@
 usage()
 {
 	(void)fprintf(stderr,
-	    "usage: whois [-adgimpQrR6] [-h hostname] name ...\n");
+	    "usage: whois [-adgimpQrRu6] [-h hostname] [-P port] name ...\n");
 	exit(EX_USAGE);
 }
