svn commit: trunk/busybox/networking/udhcp

vda at busybox.net vda at busybox.net
Sun Jun 15 05:40:10 UTC 2008


Author: vda
Date: 2008-06-14 22:40:08 -0700 (Sat, 14 Jun 2008)
New Revision: 22344

Log:
udhcpc: reduce ifdef forest, no code changes



Modified:
   trunk/busybox/networking/udhcp/dhcpc.c


Changeset:
Modified: trunk/busybox/networking/udhcp/dhcpc.c
===================================================================
--- trunk/busybox/networking/udhcp/dhcpc.c	2008-06-14 22:11:29 UTC (rev 22343)
+++ trunk/busybox/networking/udhcp/dhcpc.c	2008-06-15 05:40:08 UTC (rev 22344)
@@ -169,12 +169,8 @@
 		"no-default-options\0" No_argument   "o"
 		"foreground\0"     No_argument       "f"
 		"background\0"     No_argument       "b"
-#if ENABLE_FEATURE_UDHCPC_ARPING
-		"arping\0"         No_argument       "a"
-#endif
-#if ENABLE_FEATURE_UDHCP_PORT
-		"client-port\0"	   Required_argument "P"
-#endif
+		USE_FEATURE_UDHCPC_ARPING("arping\0"	No_argument       "a")
+		USE_FEATURE_UDHCP_PORT("client-port\0"	Required_argument "P")
 		;
 #endif
 	enum {
@@ -201,40 +197,24 @@
 		OPT_f = 1 << 20,
 /* The rest has variable bit positions, need to be clever */
 		OPTBIT_f = 20,
-#if BB_MMU
-		OPTBIT_b,
-#endif
-#if ENABLE_FEATURE_UDHCPC_ARPING
-		OPTBIT_a,
-#endif
-#if ENABLE_FEATURE_UDHCP_PORT
-		OPTBIT_P,
-#endif
-#if BB_MMU
-		OPT_b = 1 << OPTBIT_b,
-#endif
-#if ENABLE_FEATURE_UDHCPC_ARPING
-		OPT_a = 1 << OPTBIT_a,
-#endif
-#if ENABLE_FEATURE_UDHCP_PORT
-		OPT_P = 1 << OPTBIT_P,
-#endif
+		USE_FOR_MMU(              OPTBIT_b,)
+		USE_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
+		USE_FEATURE_UDHCP_PORT(   OPTBIT_P,)
+		USE_FOR_MMU(              OPT_b = 1 << OPTBIT_b,)
+		USE_FEATURE_UDHCPC_ARPING(OPT_a = 1 << OPTBIT_a,)
+		USE_FEATURE_UDHCP_PORT(   OPT_P = 1 << OPTBIT_P,)
 	};
 
 	/* Default options. */
-#if ENABLE_FEATURE_UDHCP_PORT
-	SERVER_PORT = 67;
-	CLIENT_PORT = 68;
-#endif
+	USE_FEATURE_UDHCP_PORT(SERVER_PORT = 67;)
+	USE_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;)
 	client_config.interface = "eth0";
 	client_config.script = DEFAULT_SCRIPT;
 
 	/* Parse command line */
 	/* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */
 	opt_complementary = "c--C:C--c:O::T+:t+:A+";
-#if ENABLE_GETOPT_LONG
-	applet_long_options = udhcpc_longopts;
-#endif
+	USE_GETOPT_LONG(applet_long_options = udhcpc_longopts;)
 	opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:vSA:O:of"
 		USE_FOR_MMU("b")
 		USE_FEATURE_UDHCPC_ARPING("a")
@@ -257,7 +237,7 @@
 		/* Flags: 0000NEOS
 		S: 1 => Client requests Server to update A RR in DNS as well as PTR
 		O: 1 => Server indicates to client that DNS has been updated regardless
-		E: 1 => Name data is DNS format, i.e. <4>host<6>domain<4>com<0> not "host.domain.com"
+		E: 1 => Name data is DNS format, i.e. <4>host<6>domain<3>com<0> not "host.domain.com"
 		N: 1 => Client requests Server to not update DNS
 		*/
 		client_config.fqdn[OPT_DATA + 0] = 0x1;




More information about the busybox-cvs mailing list