version 1.30, 2003/10/12 13:26:09 |
version 1.31, 2005/06/22 10:29:57 |
|
|
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; |
|
|
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) { |
|
|
} |
} |
} |
} |
} |
} |
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); |