[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.14 and 1.15

version 1.14, 2002/02/16 21:27:59 version 1.15, 2002/05/29 18:33:40
Line 162 
Line 162 
                                 if ((*argv)[i] == '.')                                  if ((*argv)[i] == '.')
                                         j = i;                                          j = i;
                         if (j != 0) {                          if (j != 0) {
                                 qnichost = (char *) calloc(i - j + 1 +                                  int len = i - j + 1 + strlen(QNICHOST_TAIL);
                                     strlen(QNICHOST_TAIL), sizeof(char));  
                                   qnichost = (char *) calloc(len, sizeof(char));
                                 if (!qnichost)                                  if (!qnichost)
                                         err(1, "malloc");                                          err(1, "malloc");
                                 strcpy(qnichost, *argv + j + 1);                                  strlcpy(qnichost, *argv + j + 1, len);
                                 strcat(qnichost, QNICHOST_TAIL);                                  strlcat(qnichost, QNICHOST_TAIL, len);
                                 memset(&hints, 0, sizeof(hints));                                  memset(&hints, 0, sizeof(hints));
                                 hints.ai_flags = 0;                                  hints.ai_flags = 0;
                                 hints.ai_family = AF_UNSPEC;                                  hints.ai_family = AF_UNSPEC;
                                 hints.ai_socktype = SOCK_STREAM;                                  hints.ai_socktype = SOCK_STREAM;
                                 error = getaddrinfo(qnichost, "whois",                                  error = getaddrinfo(qnichost, "whois",
                                                 &hints, &res);                                      &hints, &res);
                                 if (error != 0)                                  if (error != 0)
                                         errx(EX_NOHOST, "%s: %s", qnichost,                                          errx(EX_NOHOST, "%s: %s", qnichost,
                                                 gai_strerror(error));                                              gai_strerror(error));
                         }                          }
                 }                  }
                 if (!qnichost) {                  if (!qnichost) {
Line 187 
Line 188 
                         error = getaddrinfo(host, "whois", &hints, &res);                          error = getaddrinfo(host, "whois", &hints, &res);
                         if (error != 0)                          if (error != 0)
                                 errx(EX_NOHOST, "%s: %s", host,                                  errx(EX_NOHOST, "%s: %s", host,
                                         gai_strerror(error));                                      gai_strerror(error));
                 }                  }
   
                 whois(*argv++, res, flags);                  whois(*argv++, res, flags);

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15