diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-29 11:09:43 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-29 11:09:43 +0000 |
commit | c61852a02bd2d61682235ba3185173f527313827 (patch) | |
tree | 6af2895da70dda926317fac31cd4db6a4b20200c /networking | |
parent | 601ae1378ba7bb59e9c1a19fcc4ddd7bf9fb2e1b (diff) | |
download | busybox-w32-c61852a02bd2d61682235ba3185173f527313827.tar.gz busybox-w32-c61852a02bd2d61682235ba3185173f527313827.tar.bz2 busybox-w32-c61852a02bd2d61682235ba3185173f527313827.zip |
fix support for globally disabling --long-options.
(disabling them saves ~4K on fully configured bbox)
Diffstat (limited to 'networking')
-rw-r--r-- | networking/ftpgetput.c | 20 | ||||
-rw-r--r-- | networking/ipcalc.c | 27 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 5 |
3 files changed, 26 insertions, 26 deletions
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 1facfa3d8..223d2435c 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c | |||
@@ -264,15 +264,13 @@ int ftp_send(ftp_host_info_t *server, FILE *control_stream, | |||
264 | 264 | ||
265 | #if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS | 265 | #if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS |
266 | static const struct option ftpgetput_long_options[] = { | 266 | static const struct option ftpgetput_long_options[] = { |
267 | {"continue", 1, NULL, 'c'}, | 267 | { "continue", 1, NULL, 'c' }, |
268 | {"verbose", 0, NULL, 'v'}, | 268 | { "verbose", 0, NULL, 'v' }, |
269 | {"username", 1, NULL, 'u'}, | 269 | { "username", 1, NULL, 'u' }, |
270 | {"password", 1, NULL, 'p'}, | 270 | { "password", 1, NULL, 'p' }, |
271 | {"port", 1, NULL, 'P'}, | 271 | { "port", 1, NULL, 'P' }, |
272 | {0, 0, 0, 0} | 272 | { 0, 0, 0, 0 } |
273 | }; | 273 | }; |
274 | #else | ||
275 | #define ftpgetput_long_options 0 | ||
276 | #endif | 274 | #endif |
277 | 275 | ||
278 | int ftpgetput_main(int argc, char **argv) | 276 | int ftpgetput_main(int argc, char **argv) |
@@ -307,9 +305,9 @@ int ftpgetput_main(int argc, char **argv) | |||
307 | /* | 305 | /* |
308 | * Decipher the command line | 306 | * Decipher the command line |
309 | */ | 307 | */ |
310 | if (ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS) | 308 | #if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS |
311 | applet_long_options = ftpgetput_long_options; | 309 | applet_long_options = ftpgetput_long_options; |
312 | 310 | #endif | |
313 | opt = getopt32(argc, argv, "cvu:p:P:", &server->user, &server->password, &port); | 311 | opt = getopt32(argc, argv, "cvu:p:P:", &server->user, &server->password, &port); |
314 | 312 | ||
315 | /* Process the non-option command line arguments */ | 313 | /* Process the non-option command line arguments */ |
diff --git a/networking/ipcalc.c b/networking/ipcalc.c index 909373cbb..0ee9646c2 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c | |||
@@ -64,19 +64,18 @@ int get_prefix(unsigned long netmask); | |||
64 | 64 | ||
65 | #if ENABLE_FEATURE_IPCALC_LONG_OPTIONS | 65 | #if ENABLE_FEATURE_IPCALC_LONG_OPTIONS |
66 | static const struct option long_options[] = { | 66 | static const struct option long_options[] = { |
67 | {"netmask", no_argument, NULL, 'm'}, | 67 | { "netmask", no_argument, NULL, 'm' }, |
68 | {"broadcast", no_argument, NULL, 'b'}, | 68 | { "broadcast", no_argument, NULL, 'b' }, |
69 | {"network", no_argument, NULL, 'n'}, | 69 | { "network", no_argument, NULL, 'n' }, |
70 | #ifdef CONFIG_FEATURE_IPCALC_FANCY | 70 | # if ENABLE_FEATURE_IPCALC_FANCY |
71 | {"prefix", no_argument, NULL, 'p'}, | 71 | { "prefix", no_argument, NULL, 'p' }, |
72 | {"hostname", no_argument, NULL, 'h'}, | 72 | { "hostname", no_argument, NULL, 'h' }, |
73 | {"silent", no_argument, NULL, 's'}, | 73 | { "silent", no_argument, NULL, 's' }, |
74 | #endif | 74 | # endif |
75 | {NULL, 0, NULL, 0} | 75 | { NULL, 0, NULL, 0 } |
76 | }; | 76 | }; |
77 | #else | ||
78 | #define long_options 0 | ||
79 | #endif | 77 | #endif |
78 | |||
80 | int ipcalc_main(int argc, char **argv) | 79 | int ipcalc_main(int argc, char **argv) |
81 | { | 80 | { |
82 | unsigned opt; | 81 | unsigned opt; |
@@ -85,9 +84,9 @@ int ipcalc_main(int argc, char **argv) | |||
85 | struct in_addr a; | 84 | struct in_addr a; |
86 | char *ipstr; | 85 | char *ipstr; |
87 | 86 | ||
88 | if (ENABLE_FEATURE_IPCALC_LONG_OPTIONS) | 87 | #if ENABLE_FEATURE_IPCALC_LONG_OPTIONS |
89 | applet_long_options = long_options; | 88 | applet_long_options = long_options; |
90 | 89 | #endif | |
91 | opt = getopt32(argc, argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs")); | 90 | opt = getopt32(argc, argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs")); |
92 | argc -= optind; | 91 | argc -= optind; |
93 | argv += optind; | 92 | argv += optind; |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index f69b687b2..71315ff0a 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -160,6 +160,7 @@ int udhcpc_main(int argc, char *argv[]) | |||
160 | OPT_t = 1 << 16, | 160 | OPT_t = 1 << 16, |
161 | OPT_v = 1 << 17, | 161 | OPT_v = 1 << 17, |
162 | }; | 162 | }; |
163 | #if ENABLE_GETOPT_LONG | ||
163 | static const struct option arg_options[] = { | 164 | static const struct option arg_options[] = { |
164 | { "clientid", required_argument, 0, 'c' }, | 165 | { "clientid", required_argument, 0, 'c' }, |
165 | { "clientid-none", no_argument, 0, 'C' }, | 166 | { "clientid-none", no_argument, 0, 'C' }, |
@@ -181,7 +182,7 @@ int udhcpc_main(int argc, char *argv[]) | |||
181 | { "retries", required_argument, 0, 't' }, | 182 | { "retries", required_argument, 0, 't' }, |
182 | { 0, 0, 0, 0 } | 183 | { 0, 0, 0, 0 } |
183 | }; | 184 | }; |
184 | 185 | #endif | |
185 | /* Default options. */ | 186 | /* Default options. */ |
186 | client_config.interface = "eth0"; | 187 | client_config.interface = "eth0"; |
187 | client_config.script = DEFAULT_SCRIPT; | 188 | client_config.script = DEFAULT_SCRIPT; |
@@ -191,7 +192,9 @@ int udhcpc_main(int argc, char *argv[]) | |||
191 | /* Parse command line */ | 192 | /* Parse command line */ |
192 | opt_complementary = "?:c--C:C--c" // mutually exclusive | 193 | opt_complementary = "?:c--C:C--c" // mutually exclusive |
193 | ":hH:Hh"; // -h and -H are the same | 194 | ":hH:Hh"; // -h and -H are the same |
195 | #if ENABLE_GETOPT_LONG | ||
194 | applet_long_options = arg_options; | 196 | applet_long_options = arg_options; |
197 | #endif | ||
195 | opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v", | 198 | opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v", |
196 | &str_c, &str_V, &str_h, &str_h, &str_F, | 199 | &str_c, &str_V, &str_h, &str_h, &str_F, |
197 | &client_config.interface, &client_config.pidfile, &str_r, | 200 | &client_config.interface, &client_config.pidfile, &str_r, |