[BACK]Return to whois.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / whois

Diff for /src/usr.bin/whois/whois.c between version 1.5 and 1.6

version 1.5, 1999/08/16 20:24:36 version 1.6, 1999/10/03 00:42:34
Line 64 
Line 64 
 #define ANICHOST        "whois.arin.net"  #define ANICHOST        "whois.arin.net"
 #define RNICHOST        "whois.ripe.net"  #define RNICHOST        "whois.ripe.net"
 #define PNICHOST        "whois.apnic.net"  #define PNICHOST        "whois.apnic.net"
   #define MNICHOST        "whois.ra.net"
   #define QNICHOST_TAIL   ".whois-servers.net"
 #define WHOIS_PORT      43  #define WHOIS_PORT      43
   
 static void usage();  static void usage();
Line 82 
Line 84 
         struct servent *sp;          struct servent *sp;
         int s;          int s;
         char *host;          char *host;
           char *qnichost;
           int use_qnichost;
           int i, j;
   
         host = NICHOST;          host = NICHOST;
         while ((ch = getopt(argc, argv, "adh:pr")) != -1)          use_qnichost = 0;
           while ((ch = getopt(argc, argv, "adh:pmqr")) != -1)
                 switch((char)ch) {                  switch((char)ch) {
                 case 'a':                  case 'a':
                         host = ANICHOST;                          host = ANICHOST;
Line 95 
Line 101 
                 case 'h':                  case 'h':
                         host = optarg;                          host = optarg;
                         break;                          break;
                   case 'm':
                           host = MNICHOST;
                           break;
                 case 'p':                  case 'p':
                         host = PNICHOST;                          host = PNICHOST;
                         break;                          break;
                   case 'q':
                           use_qnichost = 1;
                           break;
                 case 'r':                  case 'r':
                         host = RNICHOST;                          host = RNICHOST;
                         break;                          break;
Line 111 
Line 123 
         if (!argc)          if (!argc)
                 usage();                  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)
                                           err(1, "malloc");
                                   strcpy(qnichost, *argv + j + 1);
                                   strcat(qnichost, QNICHOST_TAIL);
                                   host = qnichost;
                           }
                   }
           }
   
         s = socket(PF_INET, SOCK_STREAM, 0);          s = socket(PF_INET, SOCK_STREAM, 0);
         if (s < 0)          if (s < 0)
                 err(EX_OSERR, "socket");                  err(EX_OSERR, "socket");
Line 152 
Line 180 
 static void  static void
 usage()  usage()
 {  {
         (void)fprintf(stderr, "usage: whois [-adpr] [-h hostname] name ...\n");          (void)fprintf(stderr, "usage: whois [-admpqr] [-h hostname] name ...\n");
         exit(EX_USAGE);          exit(EX_USAGE);
 }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6