[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.30 and 1.31

version 1.30, 2003/10/12 13:26:09 version 1.31, 2005/06/22 10:29:57
Line 164 
Line 164 
 whois(const char *query, const char *server, const char *port, int flags)  whois(const char *query, const char *server, const char *port, int flags)
 {  {
         FILE *sfi, *sfo;          FILE *sfi, *sfo;
         char *buf, *p, *nhost, *nbuf = NULL;          char *buf, *p, *nhost, *nbuf = NULL, *nquery;
         size_t len;          size_t len;
         int i, s, error;          int i, s, error;
         const char *reason = NULL;          const char *reason = NULL;
Line 206 
Line 206 
                 return (1);                  return (1);
         }          }
   
           if (!strcmp(server, "whois.denic.de") ||
               !strcmp(server, "de.whois-servers.net")) {
                   if (asprintf(&nquery, "-T dn %s", query) == -1)
                           err(1, NULL);
           } else {
                   if ((nquery = strdup(query)) == NULL)
                           err(1, NULL);
           }
   
         sfi = fdopen(s, "r");          sfi = fdopen(s, "r");
         sfo = fdopen(s, "w");          sfo = fdopen(s, "w");
         if (sfi == NULL || sfo == NULL)          if (sfi == NULL || sfo == NULL)
                 err(1, "fdopen");                  err(1, "fdopen");
         (void)fprintf(sfo, "%s\r\n", query);          (void)fprintf(sfo, "%s\r\n", nquery);
         (void)fflush(sfo);          (void)fflush(sfo);
         nhost = NULL;          nhost = NULL;
         while ((buf = fgetln(sfi, &len)) != NULL) {          while ((buf = fgetln(sfi, &len)) != NULL) {
Line 254 
Line 263 
                         }                          }
                 }                  }
         }          }
         if (nbuf != NULL)          free(nbuf);
                 free(nbuf);          free(nquery);
   
         if (nhost != NULL) {          if (nhost != NULL) {
                 error = whois(query, nhost, port, 0);                  error = whois(query, nhost, port, 0);

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31