Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Oct 1999 12:40:44 +1300 (NZDT)
From:      Joe Abley <jabley@noc.clix.net.nz>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/14095: minor enhancements to whois(1)
Message-ID:  <199910022340.MAA03133@noc.clix.net.nz>

next in thread | raw e-mail | index | archive | help

>Number:         14095
>Category:       bin
>Synopsis:       Add some (cosmetic) functionality to whois(1)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct  2 16:50:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Joe Abley
>Release:        current
>Organization:
Ballistic Shoe-Shine, Inc
>Environment:

N/A

>Description:

Adds two new switches to whois(1). From revised man page:

     -m      Use the Route Arbiter Database (RADB) database. It contains route
             policy specifications for a large number of operators' networks.

     -q      Construct the name of a whois server to use from the top-level
             domain (TLD) of the supplied (single) argument, and appending
             ".whois-servers.net".  This effectively allows a suitable whois
             server to be selected automatically for a large number of TLDs.

The -m switch follows the existing -a, -d, -g, -p, -r and -R switches.

The -q switch allows the user to be more stupid in selecting a whois
server. For example, whois -q patho.gen.nz, whois -q nasa.gov,
whois -q microsoft.com and whois -q demon.co.uk all produce meaningful
results.

>How-To-Repeat:

N/A

>Fix:
	
Apply the following sterile dressing, stir gently and bake for six hours.


diff -c whois/whois.1 whois.new/whois.1
*** whois/whois.1	Sat Aug 28 12:17:00 1999
--- whois.new/whois.1	Sun Oct  3 12:34:37 1999
***************
*** 70,80 ****
--- 70,91 ----
  Use the specified host instead of the default NIC
  (whois.internic.net).
  Either a host name or an IP address may be specified.
+ .It Fl m
+ Use the Route Arbiter Database
+ .Pq Tn RADB
+ database. It contains route policy specifications for a large
+ number of operators' networks.
  .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.
+ .It Fl q
+ Construct the name of a whois server to use from the top-level domain
+ .Pq Tn TLD
+ of the supplied (single) argument, and appending ".whois-servers.net".
+ This effectively allows a suitable whois server to be selected
+ automatically for a large number of TLDs.
  .It Fl r
  Use the R\(aaeseaux IP Europ\(aaeens
  .Pq Tn RIPE
diff -c whois/whois.c whois.new/whois.c
*** whois/whois.c	Sat Aug 28 12:17:00 1999
--- whois.new/whois.c	Sun Oct  3 12:17:14 1999
***************
*** 63,68 ****
--- 63,70 ----
  #define	RNICHOST	"whois.ripe.net"
  #define	PNICHOST	"whois.apnic.net"
  #define RUNICHOST       "whois.ripn.net"
+ #define MNICHOST	"whois.ra.net"
+ #define	QNICHOST_TAIL	".whois-servers.net"
  #define	WHOIS_PORT	43
  
  static void usage __P((void));
***************
*** 79,91 ****
  	struct servent *sp;
  	int s;
  	char *host;
  
  #ifdef	SOCKS
  	SOCKSinit(argv[0]);
  #endif
  
  	host = NICHOST;
! 	while ((ch = getopt(argc, argv, "adgh:prR")) != -1)
  		switch((char)ch) {
  		case 'a':
  			host = ANICHOST;
--- 81,97 ----
  	struct servent *sp;
  	int s;
  	char *host;
+ 	char *qnichost;
+ 	int use_qnichost;
+ 	int i, j;
  
  #ifdef	SOCKS
  	SOCKSinit(argv[0]);
  #endif
  
  	host = NICHOST;
! 	use_qnichost = 0;
! 	while ((ch = getopt(argc, argv, "adgh:mpqrR")) != -1)
  		switch((char)ch) {
  		case 'a':
  			host = ANICHOST;
***************
*** 99,107 ****
--- 105,119 ----
  		case 'h':
  			host = optarg;
  			break;
+ 		case 'm':
+ 			host = MNICHOST;
+ 			break;
  		case 'p':
  			host = PNICHOST;
  			break;
+ 		case 'q':
+ 			use_qnichost = 1;
+ 			break;
  		case 'r':
  			host = RNICHOST;
  			break;
***************
*** 118,123 ****
--- 130,151 ----
  	if (!argc)
  		usage();
  
+ 	if (use_qnichost != 0) {
+ 		if (argc == 1) {
+ 			for (i = j = 0; (*argv)[i]; i++)
+ 				if ((*argv)[i] == '.') j = i;
+ 			if (j != 0) {
+ 				qnichost = (char *) calloc(i - j + 1 + \
+ 					strlen(QNICHOST_TAIL), sizeof(char));
+ 				if (qnichost) {
+ 					strcpy(qnichost, *argv + j + 1);
+ 					strcat(qnichost, QNICHOST_TAIL);
+ 					host = qnichost;
+ 				}
+ 			}
+ 		}
+ 	}
+ 
  	s = socket(PF_INET, SOCK_STREAM, 0);
  	if (s < 0)
  		err(EX_OSERR, "socket");
***************
*** 159,164 ****
  static void
  usage()
  {
! 	fprintf(stderr, "usage: whois [-adgprR] [-h hostname] name ...\n");
  	exit(EX_USAGE);
  }
--- 187,192 ----
  static void
  usage()
  {
! 	fprintf(stderr, "usage: whois [-adgmpqrR] [-h hostname] name ...\n");
  	exit(EX_USAGE);
  }

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199910022340.MAA03133>