svn commit: trunk/busybox: libbb networking

vda at busybox.net vda at busybox.net
Tue Nov 4 21:44:29 UTC 2008


Author: vda
Date: 2008-11-04 13:44:28 -0800 (Tue, 04 Nov 2008)
New Revision: 23925

Log:
nslookup: tiny shrink (-5 bytes); add comment about res_init
inet_common: cosmetics, no code changes



Modified:
   trunk/busybox/libbb/inet_common.c
   trunk/busybox/networking/nslookup.c


Changeset:
Modified: trunk/busybox/libbb/inet_common.c
===================================================================
--- trunk/busybox/libbb/inet_common.c	2008-11-04 19:58:48 UTC (rev 23924)
+++ trunk/busybox/libbb/inet_common.c	2008-11-04 21:44:28 UTC (rev 23925)
@@ -63,9 +63,6 @@
 #ifdef DEBUG
 	res_init();
 	_res.options |= RES_DEBUG;
-#endif
-
-#ifdef DEBUG
 	bb_error_msg("gethostbyname(%s)", name);
 #endif
 	hp = gethostbyname(name);

Modified: trunk/busybox/networking/nslookup.c
===================================================================
--- trunk/busybox/networking/nslookup.c	2008-11-04 19:58:48 UTC (rev 23924)
+++ trunk/busybox/networking/nslookup.c	2008-11-04 21:44:28 UTC (rev 23925)
@@ -15,8 +15,11 @@
 #include "libbb.h"
 
 /*
- *  I'm only implementing non-interactive mode;
- *  I totally forgot nslookup even had an interactive mode.
+ * I'm only implementing non-interactive mode;
+ * I totally forgot nslookup even had an interactive mode.
+ *
+ * This applet is the only user of res_init(). Without it,
+ * you may avoid pulling in _res global from libc.
  */
 
 /* Examples of 'standard' nslookup output
@@ -51,7 +54,6 @@
 {
 	/* We can't use xhost2sockaddr() - we want to get ALL addresses,
 	 * not just one */
-
 	struct addrinfo *result = NULL;
 	int rc;
 	struct addrinfo hint;
@@ -116,7 +118,7 @@
 }
 
 /* alter the global _res nameserver structure to use
-   an explicit dns server instead of what is in /etc/resolv.h */
+   an explicit dns server instead of what is in /etc/resolv.conf */
 static void set_default_dns(char *server)
 {
 	struct in_addr server_in_addr;
@@ -135,18 +137,17 @@
 	 * optional DNS server with which to do the lookup.
 	 * More than 3 arguments is an error to follow the pattern of the
 	 * standard nslookup */
-
-	if (argc < 2 || *argv[1] == '-' || argc > 3)
+	if (!argv[1] || argv[1][0] == '-' || argc > 3)
 		bb_show_usage();
 
 	/* initialize DNS structure _res used in printing the default
 	 * name server and in the explicit name server option feature. */
 	res_init();
 	/* rfc2133 says this enables IPv6 lookups */
-	/* (but it also says "may be enabled in /etc/resolv.conf|) */
+	/* (but it also says "may be enabled in /etc/resolv.conf") */
 	/*_res.options |= RES_USE_INET6;*/
 
-	if (argc == 3)
+	if (argv[2])
 		set_default_dns(argv[2]);
 
 	server_print();




More information about the busybox-cvs mailing list