[PATCH] remove "#if 0" from networking/ directory

Robert P. J. Day rpjday at mindspring.com
Sat Mar 25 23:02:59 UTC 2006


  (this is a sizable patch and you might decide to remove parts of it
for one reason or another before applying.  i explicitly left some
stuff in httpd.c since it was marked as for future extensions.)



diff -pru busybox.orig/networking/arping.c busybox/networking/arping.c
--- busybox.orig/networking/arping.c	2006-03-25 17:06:57.000000000 -0500
+++ busybox/networking/arping.c	2006-03-25 17:56:35.000000000 -0500
@@ -51,17 +51,6 @@ static int req_recv;

 #define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
 			   ((tv1).tv_usec-(tv2).tv_usec)/1000 )
-#if 0
-static void set_signal(int signo, void (*handler) (void))
-{
-	struct sigaction sa;
-
-	memset(&sa, 0, sizeof(sa));
-	sa.sa_handler = (void (*)(int)) handler;
-	sa.sa_flags = SA_RESTART;
-	sigaction(signo, &sa, NULL);
-}
-#endif

 static int send_pack(int sock, struct in_addr *src_addr,
 					 struct in_addr *dst_addr, struct sockaddr_ll *ME,
diff -pru busybox.orig/networking/httpd.c busybox/networking/httpd.c
--- busybox.orig/networking/httpd.c	2006-03-25 17:06:57.000000000 -0500
+++ busybox/networking/httpd.c	2006-03-25 17:57:56.000000000 -0500
@@ -305,11 +305,6 @@ static const char* const suffixTable []
   ".mpe.mpeg", "video/mpeg",
   ".mid.midi", "audio/midi",
   ".mp3", "audio/mpeg",
-#if 0                        /* unpopular */
-  ".au", "audio/basic",
-  ".pac", "application/x-ns-proxy-autoconfig",
-  ".vrml.wrl", "model/vrml",
-#endif
   0, "application/octet-stream" /* default */
   };

diff -pru busybox.orig/networking/ifupdown.c busybox/networking/ifupdown.c
--- busybox.orig/networking/ifupdown.c	2006-03-25 17:06:57.000000000 -0500
+++ busybox/networking/ifupdown.c	2006-03-25 17:58:13.000000000 -0500
@@ -43,11 +43,7 @@
 #define MAX_INTERFACE_LENGTH 10
 #endif

-#if 0
-#define debug_noise(fmt, args...) printf(fmt, ## args)
-#else
 #define debug_noise(fmt, args...)
-#endif

 /* Forward declaration */
 struct interface_defn_t;
diff -pru busybox.orig/networking/interface.c busybox/networking/interface.c
--- busybox.orig/networking/interface.c	2006-03-25 17:06:57.000000000 -0500
+++ busybox/networking/interface.c	2006-03-25 17:58:50.000000000 -0500
@@ -1656,19 +1656,6 @@ static void hwinit()
 #endif							/* KEEP_UNUSED */

 #ifdef IFF_PORTSEL
-#if 0
-static const char * const if_port_text[][4] = {
-	/* Keep in step with <linux/netdevice.h> */
-	{"unknown", NULL, NULL, NULL},
-	{"10base2", "bnc", "coax", NULL},
-	{"10baseT", "utp", "tpe", NULL},
-	{"AUI", "thick", "db15", NULL},
-	{"100baseT", NULL, NULL, NULL},
-	{"100baseTX", NULL, NULL, NULL},
-	{"100baseFX", NULL, NULL, NULL},
-	{NULL, NULL, NULL, NULL},
-};
-#else
 static const char * const if_port_text[] = {
 	/* Keep in step with <linux/netdevice.h> */
 	"unknown",
@@ -1681,7 +1668,6 @@ static const char * const if_port_text[]
 	NULL
 };
 #endif
-#endif

 /* Check our hardware type table for this type. */
 static const struct hwtype *get_hwntype(int type)
@@ -1728,24 +1714,12 @@ static void print_bytes_scaled(unsigned
 	int_part = ull;
 	i = 4;
 	do {
-#if 0
-		/* This does correct rounding and is a little larger.  But it
-		 * uses KiB as the smallest displayed unit. */
-		if ((int_part < (1024*1024 - 51)) || !--i) {
-			i = 0;
-			int_part += 51;		/* 1024*.05 = 51.2 */
-			frac_part = ((((unsigned int) int_part) & (1024-1)) * 10) / 1024;
-		}
-		int_part /= 1024;
-		ext += 3;	/* KiB, MiB, GiB, TiB */
-#else
 		if (int_part >= 1024) {
 			frac_part = ((((unsigned int) int_part) & (1024-1)) * 10) / 1024;
 			int_part /= 1024;
 			ext += 3;	/* KiB, MiB, GiB, TiB */
 		}
 		--i;
-#endif
 	} while (i);

 	printf("X bytes:%Lu (%Lu.%u %sB)%s", ull, int_part, frac_part, ext, end);
diff -pru busybox.orig/networking/ip.c busybox/networking/ip.c
--- busybox.orig/networking/ip.c	2006-03-25 17:06:57.000000000 -0500
+++ busybox/networking/ip.c	2006-03-25 17:59:14.000000000 -0500
@@ -25,58 +25,6 @@

 #include "busybox.h"

-#if 0
-int preferred_family = AF_UNSPEC;
-int oneline = 0;
-char * _SL_ = NULL;
-
-void ip_parse_common_args(int *argcp, char ***argvp)
-{
-	int argc = *argcp;
-	char **argv = *argvp;
-
-	while (argc > 1) {
-		char *opt = argv[1];
-
-		if (strcmp(opt,"--") == 0) {
-			argc--; argv++;
-			break;
-		}
-
-		if (opt[0] != '-')
-			break;
-
-		if (opt[1] == '-')
-			opt++;
-
-		if (matches(opt, "-family") == 0) {
-			argc--;
-			argv++;
-			if (strcmp(argv[1], "inet") == 0)
-				preferred_family = AF_INET;
-			else if (strcmp(argv[1], "inet6") == 0)
-				preferred_family = AF_INET6;
-			else if (strcmp(argv[1], "link") == 0)
-				preferred_family = AF_PACKET;
-			else
-				invarg(argv[1], "invalid protocol family");
-		} else if (strcmp(opt, "-4") == 0) {
-			preferred_family = AF_INET;
-		} else if (strcmp(opt, "-6") == 0) {
-			preferred_family = AF_INET6;
-		} else if (strcmp(opt, "-0") == 0) {
-			preferred_family = AF_PACKET;
-		} else if (matches(opt, "-oneline") == 0) {
-			++oneline;
-		} else {
-			bb_show_usage();
-		}
-		argc--;	argv++;
-	}
-	_SL_ = oneline ? "\\" : "\n" ;
-}
-#endif
-
 int ip_main(int argc, char **argv)
 {
 	int ret = EXIT_FAILURE;
diff -pru busybox.orig/networking/libiproute/ipaddress.c busybox/networking/libiproute/ipaddress.c
--- busybox.orig/networking/libiproute/ipaddress.c	2006-03-25 17:06:56.000000000 -0500
+++ busybox/networking/libiproute/ipaddress.c	2006-03-25 17:57:37.000000000 -0500
@@ -58,17 +58,6 @@ static void print_link_flags(FILE *fp, u
 	_PF(POINTOPOINT);
 	_PF(MULTICAST);
 	_PF(NOARP);
-#if 0
-	_PF(ALLMULTI);
-	_PF(PROMISC);
-	_PF(MASTER);
-	_PF(SLAVE);
-	_PF(DEBUG);
-	_PF(DYNAMIC);
-	_PF(AUTOMEDIA);
-	_PF(PORTSEL);
-	_PF(NOTRAILERS);
-#endif
 	_PF(UP);
 #undef _PF
 	if (flags)
@@ -525,10 +514,6 @@ int ipaddr_list_or_flush(int argc, char
 				exit(1);
 			}
 			if (filter.flushed == 0) {
-#if 0
-				if (round == 0)
-					fprintf(stderr, "Nothing to flush.\n");
-#endif
 				fflush(stdout);
 				return 0;
 			}
diff -pru busybox.orig/networking/ping6.c busybox/networking/ping6.c
--- busybox.orig/networking/ping6.c	2006-03-25 17:06:57.000000000 -0500
+++ busybox/networking/ping6.c	2006-03-25 17:59:27.000000000 -0500
@@ -352,12 +352,6 @@ static void ping(const char *host)
 		struct icmp6_filter filt;
 		if (!(options & O_VERBOSE)) {
 			ICMP6_FILTER_SETBLOCKALL(&filt);
-#if 0
-			if ((options & F_FQDN) || (options & F_FQDNOLD) ||
-				(options & F_NODEADDR) || (options & F_SUPTYPES))
-				ICMP6_FILTER_SETPASS(ICMP6_NI_REPLY, &filt);
-			else
-#endif
 				ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY, &filt);
 		} else {
 			ICMP6_FILTER_SETPASSALL(&filt);
diff -pru busybox.orig/networking/route.c busybox/networking/route.c
--- busybox.orig/networking/route.c	2006-03-25 17:06:57.000000000 -0500
+++ busybox/networking/route.c	2006-03-25 17:59:49.000000000 -0500
@@ -287,11 +287,6 @@ static void INET_setroute(int action, ch
 			rt.rt_flags |= RTF_IRTT;
 			rt.rt_irtt = bb_xgetularg10(args_m1);
 			rt.rt_irtt *= (sysconf(_SC_CLK_TCK) / 100);	/* FIXME */
-#if 0					/* FIXME: do we need to check anything of this? */
-			if (rt.rt_irtt < 1 || rt.rt_irtt > (120 * HZ)) {
-				bb_error_msg_and_die("bad irtt");
-			}
-#endif
 			continue;
 		}
 #endif
@@ -634,11 +629,7 @@ static void INET6_displayroutes(int nore
 			snaddr6.sin6_family = AF_INET6;
 			INET6_rresolve(naddr6, sizeof(naddr6),
 						   (struct sockaddr_in6 *) &snaddr6,
-#if 0
-						   (noresolve | 0x8000) /* Default instead of *. */
-#else
 						   0x0fff /* Apparently, upstream never resolves. */
-#endif
 						   );

 			if (!r) {			/* 1st pass */
diff -pru busybox.orig/networking/telnet.c busybox/networking/telnet.c
--- busybox.orig/networking/telnet.c	2006-03-25 17:06:57.000000000 -0500
+++ busybox/networking/telnet.c	2006-03-25 18:00:13.000000000 -0500
@@ -34,10 +34,6 @@
 #include <netinet/in.h>
 #include "busybox.h"

-#if 0
-enum { DOTRACE = 1 };
-#endif
-
 #ifdef DOTRACE
 #include <arpa/inet.h> /* for inet_ntoa()... */
 #define TRACE(x, y) do { if (x) printf y; } while (0)
@@ -45,12 +41,7 @@ enum { DOTRACE = 1 };
 #define TRACE(x, y)
 #endif

-#if 0
-#define USE_POLL
-#include <sys/poll.h>
-#else
 #include <sys/time.h>
-#endif

 #define DATABUFSIZE  128
 #define IACBUFSIZE   128
@@ -318,17 +309,6 @@ static void putiac2(byte wwdd, byte c)
 	putiac(c);
 }

-#if 0
-static void putiac1(byte c)
-{
-	if (G.iaclen + 2 > IACBUFSIZE)
-		iacflush();
-
-	putiac(IAC);
-	putiac(c);
-}
-#endif
-
 #ifdef CONFIG_FEATURE_TELNET_TTYPE
 static void putiac_subopt(byte c, char *str)
 {

Signed off by:  Robert P. J. Day <rpjday at mindspring.com>



More information about the busybox mailing list