aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2001-05-28 21:37:29 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2001-05-28 21:37:29 +0000
commit861c52f1c446d05e3e83bd9c5ca5ffae9c2a1c75 (patch)
treeae9d4c703d22b3d2bca2f4d566050ad471351c5f
parentc59c7f97adbd4ca1265059a3f91bc69d9c74cf06 (diff)
Notes
-rw-r--r--usr.bin/whois/whois.16
-rw-r--r--usr.bin/whois/whois.c19
2 files changed, 19 insertions, 6 deletions
diff --git a/usr.bin/whois/whois.1 b/usr.bin/whois/whois.1
index 5072473867581..debe3b156803a 100644
--- a/usr.bin/whois/whois.1
+++ b/usr.bin/whois/whois.1
@@ -86,6 +86,12 @@ of the supplied (single) argument, and appending
.Qq Li .whois-servers.net .
This effectively allows a suitable whois server to be selected
automatically for a large number of TLDs.
+.Pp
+In the event that an IP
+address is specified, the whois server will default to the American
+Registry for Internet Numbers
+.Pq Tn ARIN .
+.Pp
If no required
.Pa whois-servers.net
subdomain found, fallback to
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c
index af03a1235b27a..3e31a6550e3f1 100644
--- a/usr.bin/whois/whois.c
+++ b/usr.bin/whois/whois.c
@@ -49,6 +49,7 @@ static const char rcsid[] =
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <ctype.h>
#include <err.h>
#include <netdb.h>
#include <stdio.h>
@@ -166,13 +167,19 @@ main(argc, argv)
}
}
if (j != 0) {
- qnichost = (char *) calloc(i - j + 1 +
- strlen(QNICHOST_TAIL), sizeof(char));
- if (!qnichost) {
- err(1, "calloc");
+ if (isdigit(*(*argv + j + 1))) {
+ (void) asprintf(&qnichost, "%s",
+ ANICHOST);
+ } else {
+ qnichost = (char *) calloc(i - j
+ + 1 + strlen(QNICHOST_TAIL),
+ sizeof(char));
+ if (!qnichost) {
+ err(1, "calloc");
+ }
+ strcpy(qnichost, *argv + j + 1);
+ strcat(qnichost, QNICHOST_TAIL);
}
- strcpy(qnichost, *argv + j + 1);
- strcat(qnichost, QNICHOST_TAIL);
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0;