udhcpc: reduce ifdef forest, no code changes

This commit is contained in:
Denis Vlasenko 2008-06-15 05:40:08 +00:00
parent e235285c3a
commit 873b895d50

View File

@ -169,12 +169,8 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
"no-default-options\0" No_argument "o" "no-default-options\0" No_argument "o"
"foreground\0" No_argument "f" "foreground\0" No_argument "f"
"background\0" No_argument "b" "background\0" No_argument "b"
#if ENABLE_FEATURE_UDHCPC_ARPING USE_FEATURE_UDHCPC_ARPING("arping\0" No_argument "a")
"arping\0" No_argument "a" USE_FEATURE_UDHCP_PORT("client-port\0" Required_argument "P")
#endif
#if ENABLE_FEATURE_UDHCP_PORT
"client-port\0" Required_argument "P"
#endif
; ;
#endif #endif
enum { enum {
@ -201,40 +197,24 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
OPT_f = 1 << 20, OPT_f = 1 << 20,
/* The rest has variable bit positions, need to be clever */ /* The rest has variable bit positions, need to be clever */
OPTBIT_f = 20, OPTBIT_f = 20,
#if BB_MMU USE_FOR_MMU( OPTBIT_b,)
OPTBIT_b, USE_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
#endif USE_FEATURE_UDHCP_PORT( OPTBIT_P,)
#if ENABLE_FEATURE_UDHCPC_ARPING USE_FOR_MMU( OPT_b = 1 << OPTBIT_b,)
OPTBIT_a, USE_FEATURE_UDHCPC_ARPING(OPT_a = 1 << OPTBIT_a,)
#endif USE_FEATURE_UDHCP_PORT( OPT_P = 1 << OPTBIT_P,)
#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
}; };
/* Default options. */ /* Default options. */
#if ENABLE_FEATURE_UDHCP_PORT USE_FEATURE_UDHCP_PORT(SERVER_PORT = 67;)
SERVER_PORT = 67; USE_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;)
CLIENT_PORT = 68;
#endif
client_config.interface = "eth0"; client_config.interface = "eth0";
client_config.script = DEFAULT_SCRIPT; client_config.script = DEFAULT_SCRIPT;
/* Parse command line */ /* Parse command line */
/* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */ /* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */
opt_complementary = "c--C:C--c:O::T+:t+:A+"; opt_complementary = "c--C:C--c:O::T+:t+:A+";
#if ENABLE_GETOPT_LONG USE_GETOPT_LONG(applet_long_options = udhcpc_longopts;)
applet_long_options = udhcpc_longopts;
#endif
opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:vSA:O:of" opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:vSA:O:of"
USE_FOR_MMU("b") USE_FOR_MMU("b")
USE_FEATURE_UDHCPC_ARPING("a") USE_FEATURE_UDHCPC_ARPING("a")
@ -257,7 +237,7 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv)
/* Flags: 0000NEOS /* Flags: 0000NEOS
S: 1 => Client requests Server to update A RR in DNS as well as PTR 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 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 N: 1 => Client requests Server to not update DNS
*/ */
client_config.fqdn[OPT_DATA + 0] = 0x1; client_config.fqdn[OPT_DATA + 0] = 0x1;