aboutsummaryrefslogtreecommitdiff
path: root/networking/nslookup.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-22 22:46:04 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-22 22:46:04 +0000
commit5de9e9ce0bcc5aacb53ec45e36b3fa6b5c7ab5f6 (patch)
tree5ef5305297b2b964500873bed682f31b12d1479e /networking/nslookup.c
parent9adc6ced4fcab4d8a068874c55d5f563ce9e62f9 (diff)
downloadbusybox-5de9e9ce0bcc5aacb53ec45e36b3fa6b5c7ab5f6.tar.gz
clean up commented out old code
Diffstat (limited to 'networking/nslookup.c')
-rw-r--r--networking/nslookup.c55
1 files changed, 1 insertions, 54 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c
index af0816215..914f3f5ee 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -47,57 +47,8 @@
* ns3.kernel.org internet address = 204.152.191.36
*/
-/*static int sockaddr_to_dotted(struct sockaddr *saddr, char *buf, int buflen)
-{
- if (buflen <= 0) return -1;
- buf[0] = '\0';
- if (saddr->sa_family == AF_INET) {
- inet_ntop(AF_INET, &((struct sockaddr_in*)saddr)->sin_addr, buf, buflen);
- return 0;
- }
- if (saddr->sa_family == AF_INET6) {
- inet_ntop(AF_INET6, &((struct sockaddr_in6*)saddr)->sin6_addr, buf, buflen);
- return 0;
- }
- return -1;
-}
-*/
-
static int print_host(const char *hostname, const char *header)
{
-#if 0
- char str[128]; /* IPv6 address will fit, hostnames hopefully too */
- struct addrinfo *result = NULL;
- int rc;
- struct addrinfo hint;
-
- memset(&hint, 0 , sizeof(hint));
- /* hint.ai_family = AF_UNSPEC; - zero anyway */
- /* Needed. Or else we will get each address thrice (or more)
- * for each possible socket type (tcp,udp,raw...): */
- hint.ai_socktype = SOCK_STREAM;
- // hint.ai_flags = AI_CANONNAME;
- rc = getaddrinfo(hostname, NULL /*service*/, &hint, &result);
-
- if (!rc) {
- struct addrinfo *cur = result;
- // printf("%s\n", cur->ai_canonname); ?
- while (cur) {
- sockaddr_to_dotted(cur->ai_addr, str, sizeof(str));
- printf("%s %s\nAddress: %s", header, hostname, str);
- str[0] = ' ';
- if (getnameinfo(cur->ai_addr, cur->ai_addrlen, str+1, sizeof(str)-1, NULL, 0, NI_NAMEREQD))
- str[0] = '\0';
- puts(str);
- cur = cur->ai_next;
- }
- } else {
- bb_error_msg("getaddrinfo('%s') failed: %s", hostname, gai_strerror(rc));
- }
- freeaddrinfo(result);
- return (rc != 0);
-
-#else
/* We can't use host2sockaddr() - we want to get ALL addresses,
* not just one */
@@ -136,7 +87,7 @@ static int print_host(const char *hostname, const char *header)
}
} else {
#if ENABLE_VERBOSE_RESOLUTION_ERRORS
- bb_error_msg("getaddrinfo('%s') failed: %s", hostname, gai_strerror(rc));
+ bb_error_msg("can't resolve '%s': %s", hostname, gai_strerror(rc));
#else
bb_error_msg("can't resolve '%s'", hostname);
#endif
@@ -144,10 +95,8 @@ static int print_host(const char *hostname, const char *header)
if (ENABLE_FEATURE_CLEAN_UP)
freeaddrinfo(result);
return (rc != 0);
-#endif
}
-
/* lookup the default nameserver and display it */
static void server_print(void)
{
@@ -167,7 +116,6 @@ static void server_print(void)
puts("");
}
-
/* alter the global _res nameserver structure to use
an explicit dns server instead of what is in /etc/resolv.h */
static void set_default_dns(char *server)
@@ -180,7 +128,6 @@ static void set_default_dns(char *server)
}
}
-
int nslookup_main(int argc, char **argv)
{
/* We allow 1 or 2 arguments.