aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-11-04 21:44:28 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-11-04 21:44:28 +0000
commit391ffa19d1e0813c51d51b29117d119b1dc57c49 (patch)
treeefbd51e4a2371f06a6055c9ecb4b86eca71d9d34
parentc51457ca5b0c1938c9b6813c7d72aa7d70fa88f8 (diff)
downloadbusybox-w32-391ffa19d1e0813c51d51b29117d119b1dc57c49.tar.gz
busybox-w32-391ffa19d1e0813c51d51b29117d119b1dc57c49.tar.bz2
busybox-w32-391ffa19d1e0813c51d51b29117d119b1dc57c49.zip
nslookup: tiny shrink (-5 bytes); add comment about res_init
inet_common: cosmetics, no code changes
-rw-r--r--libbb/inet_common.c3
-rw-r--r--networking/nslookup.c17
2 files changed, 9 insertions, 11 deletions
diff --git a/libbb/inet_common.c b/libbb/inet_common.c
index 3a20b4a16..966a021e5 100644
--- a/libbb/inet_common.c
+++ b/libbb/inet_common.c
@@ -63,9 +63,6 @@ int FAST_FUNC INET_resolve(const char *name, struct sockaddr_in *s_in, int hostf
63#ifdef DEBUG 63#ifdef DEBUG
64 res_init(); 64 res_init();
65 _res.options |= RES_DEBUG; 65 _res.options |= RES_DEBUG;
66#endif
67
68#ifdef DEBUG
69 bb_error_msg("gethostbyname(%s)", name); 66 bb_error_msg("gethostbyname(%s)", name);
70#endif 67#endif
71 hp = gethostbyname(name); 68 hp = gethostbyname(name);
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 183ae152d..73ccb0ddd 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -15,8 +15,11 @@
15#include "libbb.h" 15#include "libbb.h"
16 16
17/* 17/*
18 * I'm only implementing non-interactive mode; 18 * I'm only implementing non-interactive mode;
19 * I totally forgot nslookup even had an interactive mode. 19 * I totally forgot nslookup even had an interactive mode.
20 *
21 * This applet is the only user of res_init(). Without it,
22 * you may avoid pulling in _res global from libc.
20 */ 23 */
21 24
22/* Examples of 'standard' nslookup output 25/* Examples of 'standard' nslookup output
@@ -51,7 +54,6 @@ static int print_host(const char *hostname, const char *header)
51{ 54{
52 /* We can't use xhost2sockaddr() - we want to get ALL addresses, 55 /* We can't use xhost2sockaddr() - we want to get ALL addresses,
53 * not just one */ 56 * not just one */
54
55 struct addrinfo *result = NULL; 57 struct addrinfo *result = NULL;
56 int rc; 58 int rc;
57 struct addrinfo hint; 59 struct addrinfo hint;
@@ -116,7 +118,7 @@ static void server_print(void)
116} 118}
117 119
118/* alter the global _res nameserver structure to use 120/* alter the global _res nameserver structure to use
119 an explicit dns server instead of what is in /etc/resolv.h */ 121 an explicit dns server instead of what is in /etc/resolv.conf */
120static void set_default_dns(char *server) 122static void set_default_dns(char *server)
121{ 123{
122 struct in_addr server_in_addr; 124 struct in_addr server_in_addr;
@@ -135,18 +137,17 @@ int nslookup_main(int argc, char **argv)
135 * optional DNS server with which to do the lookup. 137 * optional DNS server with which to do the lookup.
136 * More than 3 arguments is an error to follow the pattern of the 138 * More than 3 arguments is an error to follow the pattern of the
137 * standard nslookup */ 139 * standard nslookup */
138 140 if (!argv[1] || argv[1][0] == '-' || argc > 3)
139 if (argc < 2 || *argv[1] == '-' || argc > 3)
140 bb_show_usage(); 141 bb_show_usage();
141 142
142 /* initialize DNS structure _res used in printing the default 143 /* initialize DNS structure _res used in printing the default
143 * name server and in the explicit name server option feature. */ 144 * name server and in the explicit name server option feature. */
144 res_init(); 145 res_init();
145 /* rfc2133 says this enables IPv6 lookups */ 146 /* rfc2133 says this enables IPv6 lookups */
146 /* (but it also says "may be enabled in /etc/resolv.conf|) */ 147 /* (but it also says "may be enabled in /etc/resolv.conf") */
147 /*_res.options |= RES_USE_INET6;*/ 148 /*_res.options |= RES_USE_INET6;*/
148 149
149 if (argc == 3) 150 if (argv[2])
150 set_default_dns(argv[2]); 151 set_default_dns(argv[2]);
151 152
152 server_print(); 153 server_print();