diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-22 21:41:14 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-22 21:41:14 +0000 |
commit | 68af8e7a084317191effa9b257483a50d994b11c (patch) | |
tree | c406bce2135c666a2bbdff510b2e05df317bfc36 | |
parent | b559105cfbbfb662a6e15e169a469e8a95a9ccf4 (diff) | |
download | busybox-w32-68af8e7a084317191effa9b257483a50d994b11c.tar.gz busybox-w32-68af8e7a084317191effa9b257483a50d994b11c.tar.bz2 busybox-w32-68af8e7a084317191effa9b257483a50d994b11c.zip |
udhcpc: remove -W option, -A can be reused for that
help texts: trimmed a bit
static.udhcpc_longopts 227 209 -18
udhcpc_main 2633 2590 -43
packed_usage 22927 22871 -56
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-117) Total: -117 bytes
-rw-r--r-- | include/usage.h | 28 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 21 |
2 files changed, 19 insertions, 30 deletions
diff --git a/include/usage.h b/include/usage.h index 5c03719d6..15ef44ab1 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -3856,10 +3856,10 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when | |||
3856 | "\n -C,--clientid-none Suppress default client identifier" \ | 3856 | "\n -C,--clientid-none Suppress default client identifier" \ |
3857 | "\n -p,--pidfile=file Create pidfile" \ | 3857 | "\n -p,--pidfile=file Create pidfile" \ |
3858 | "\n -r,--request=IP IP address to request" \ | 3858 | "\n -r,--request=IP IP address to request" \ |
3859 | "\n -s,--script=file Run file at dhcp events (default: /usr/share/udhcpc/default.script)" \ | 3859 | "\n -s,--script=file Run file at dhcp events (default /usr/share/udhcpc/default.script)" \ |
3860 | "\n -t,--retries=N Send up to N request packets" \ | 3860 | "\n -t,--retries=N Send up to N request packets" \ |
3861 | "\n -T,--timeout=N Try to get a lease for N seconds (default 3)" \ | 3861 | "\n -T,--timeout=N Try to get a lease for N seconds (default 3)" \ |
3862 | "\n -A,--tryagain=N Wait N seconds (default 60) after failure" \ | 3862 | "\n -A,--tryagain=N Wait N seconds (default 20) after failure" \ |
3863 | "\n -f,--foreground Run in foreground" \ | 3863 | "\n -f,--foreground Run in foreground" \ |
3864 | "\n -b,--background Background if lease is not immediately obtained" \ | 3864 | "\n -b,--background Background if lease is not immediately obtained" \ |
3865 | "\n -S,--syslog Log to syslog too" \ | 3865 | "\n -S,--syslog Log to syslog too" \ |
@@ -3868,7 +3868,6 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when | |||
3868 | "\n -R,--release Release IP on quit" \ | 3868 | "\n -R,--release Release IP on quit" \ |
3869 | USE_FEATURE_UDHCPC_ARPING( \ | 3869 | USE_FEATURE_UDHCPC_ARPING( \ |
3870 | "\n -a,--arping Use arping to validate offered address" \ | 3870 | "\n -a,--arping Use arping to validate offered address" \ |
3871 | "\n -W,--wait=N Wait N seconds after declining (default 10)" \ | ||
3872 | ) \ | 3871 | ) \ |
3873 | ) \ | 3872 | ) \ |
3874 | SKIP_GETOPT_LONG( \ | 3873 | SKIP_GETOPT_LONG( \ |
@@ -3879,10 +3878,10 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when | |||
3879 | "\n -C Suppress default client identifier" \ | 3878 | "\n -C Suppress default client identifier" \ |
3880 | "\n -p file Create pidfile" \ | 3879 | "\n -p file Create pidfile" \ |
3881 | "\n -r IP IP address to request" \ | 3880 | "\n -r IP IP address to request" \ |
3882 | "\n -s file Run file at dhcp events (default: /usr/share/udhcpc/default.script)" \ | 3881 | "\n -s file Run file at dhcp events (default /usr/share/udhcpc/default.script)" \ |
3883 | "\n -t N Send up to N request packets" \ | 3882 | "\n -t N Send up to N request packets" \ |
3884 | "\n -T N Try to get a lease for N seconds (default 3)" \ | 3883 | "\n -T N Try to get a lease for N seconds (default 3)" \ |
3885 | "\n -A N Wait N seconds (default 60) after failure" \ | 3884 | "\n -A N Wait N seconds (default 20) after failure" \ |
3886 | "\n -f Run in foreground" \ | 3885 | "\n -f Run in foreground" \ |
3887 | "\n -b Background if lease is not immediately obtained" \ | 3886 | "\n -b Background if lease is not immediately obtained" \ |
3888 | "\n -S Log to syslog too" \ | 3887 | "\n -S Log to syslog too" \ |
@@ -3891,7 +3890,6 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when | |||
3891 | "\n -R Release IP on quit" \ | 3890 | "\n -R Release IP on quit" \ |
3892 | USE_FEATURE_UDHCPC_ARPING( \ | 3891 | USE_FEATURE_UDHCPC_ARPING( \ |
3893 | "\n -a Use arping to validate offered address" \ | 3892 | "\n -a Use arping to validate offered address" \ |
3894 | "\n -W N Wait N seconds after declining (default 10)" \ | ||
3895 | ) \ | 3893 | ) \ |
3896 | ) | 3894 | ) |
3897 | 3895 | ||
@@ -3921,17 +3919,17 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when | |||
3921 | "$ umount /dev/hdc1\n" | 3919 | "$ umount /dev/hdc1\n" |
3922 | 3920 | ||
3923 | #define uname_trivial_usage \ | 3921 | #define uname_trivial_usage \ |
3924 | "[OPTION]..." | 3922 | "[-amnrspv]" |
3925 | #define uname_full_usage \ | 3923 | #define uname_full_usage \ |
3926 | "Print certain system information. With no OPTION, same as -s." \ | 3924 | "Print system information." \ |
3927 | "\n\nOptions:\n" \ | 3925 | "\n\nOptions:\n" \ |
3928 | " -a Print all information\n" \ | 3926 | " -a Print all\n" \ |
3929 | " -m The machine (hardware) type\n" \ | 3927 | " -m The machine (hardware) type\n" \ |
3930 | " -n Print machine's hostname\n" \ | 3928 | " -n Hostname\n" \ |
3931 | " -r Print OS release\n" \ | 3929 | " -r OS release\n" \ |
3932 | " -s Print OS name\n" \ | 3930 | " -s OS name (default)\n" \ |
3933 | " -p Print host processor type\n" \ | 3931 | " -p Processor type\n" \ |
3934 | " -v Print OS version" | 3932 | " -v OS version" |
3935 | #define uname_example_usage \ | 3933 | #define uname_example_usage \ |
3936 | "$ uname -a\n" \ | 3934 | "$ uname -a\n" \ |
3937 | "Linux debian 2.4.23 #2 Tue Dec 23 17:09:10 MST 2003 i686 GNU/Linux\n" | 3935 | "Linux debian 2.4.23 #2 Tue Dec 23 17:09:10 MST 2003 i686 GNU/Linux\n" |
@@ -3942,7 +3940,7 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when | |||
3942 | "Uncompress .Z file[s]" \ | 3940 | "Uncompress .Z file[s]" \ |
3943 | "\n\nOptions:\n" \ | 3941 | "\n\nOptions:\n" \ |
3944 | " -c Extract to stdout\n" \ | 3942 | " -c Extract to stdout\n" \ |
3945 | " -f Force overwrite an existing file" | 3943 | " -f Overwrite an existing file" |
3946 | 3944 | ||
3947 | #define unexpand_trivial_usage \ | 3945 | #define unexpand_trivial_usage \ |
3948 | "[-f][-a][-t NUM] [FILE|-]" | 3946 | "[-f][-a][-t NUM] [FILE|-]" |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 234ecfd13..6ade1ee34 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -145,13 +145,12 @@ int udhcpc_main(int argc, char **argv) | |||
145 | { | 145 | { |
146 | uint8_t *temp, *message; | 146 | uint8_t *temp, *message; |
147 | char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_A, *str_t; | 147 | char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_A, *str_t; |
148 | int tryagain_timeout = 60; | ||
149 | int discover_timeout = 3; | ||
150 | int discover_retries = 3; | ||
151 | #if ENABLE_FEATURE_UDHCPC_ARPING | 148 | #if ENABLE_FEATURE_UDHCPC_ARPING |
152 | int decline_wait = 10; | ||
153 | char *str_W; | 149 | char *str_W; |
154 | #endif | 150 | #endif |
151 | int tryagain_timeout = 20; | ||
152 | int discover_timeout = 3; | ||
153 | int discover_retries = 3; | ||
155 | uint32_t xid = 0; | 154 | uint32_t xid = 0; |
156 | uint32_t lease_seconds = 0; /* can be given as 32-bit quantity */ | 155 | uint32_t lease_seconds = 0; /* can be given as 32-bit quantity */ |
157 | unsigned t1 = 0, t2 = 0; /* what a wonderful names */ | 156 | unsigned t1 = 0, t2 = 0; /* what a wonderful names */ |
@@ -199,7 +198,6 @@ int udhcpc_main(int argc, char **argv) | |||
199 | "foreground\0" No_argument "f" | 198 | "foreground\0" No_argument "f" |
200 | "background\0" No_argument "b" | 199 | "background\0" No_argument "b" |
201 | "hostname\0" Required_argument "H" | 200 | "hostname\0" Required_argument "H" |
202 | "hostname\0" Required_argument "h" | ||
203 | "fqdn\0" Required_argument "F" | 201 | "fqdn\0" Required_argument "F" |
204 | "interface\0" Required_argument "i" | 202 | "interface\0" Required_argument "i" |
205 | "now\0" No_argument "n" | 203 | "now\0" No_argument "n" |
@@ -215,7 +213,6 @@ int udhcpc_main(int argc, char **argv) | |||
215 | "syslog\0" No_argument "S" | 213 | "syslog\0" No_argument "S" |
216 | #if ENABLE_FEATURE_UDHCPC_ARPING | 214 | #if ENABLE_FEATURE_UDHCPC_ARPING |
217 | "arping\0" No_argument "a" | 215 | "arping\0" No_argument "a" |
218 | "wait\0" Required_argument "W" | ||
219 | #endif | 216 | #endif |
220 | ; | 217 | ; |
221 | #endif | 218 | #endif |
@@ -224,8 +221,7 @@ int udhcpc_main(int argc, char **argv) | |||
224 | client_config.script = DEFAULT_SCRIPT; | 221 | client_config.script = DEFAULT_SCRIPT; |
225 | 222 | ||
226 | /* Parse command line */ | 223 | /* Parse command line */ |
227 | opt_complementary = "c--C:C--c" // mutually exclusive | 224 | opt_complementary = "c--C:C--c"; // mutually exclusive |
228 | ":hH:Hh"; // -h and -H are the same | ||
229 | #if ENABLE_GETOPT_LONG | 225 | #if ENABLE_GETOPT_LONG |
230 | applet_long_options = udhcpc_longopts; | 226 | applet_long_options = udhcpc_longopts; |
231 | #endif | 227 | #endif |
@@ -246,7 +242,7 @@ int udhcpc_main(int argc, char **argv) | |||
246 | client_config.foreground = 1; | 242 | client_config.foreground = 1; |
247 | if (opt & OPT_b) | 243 | if (opt & OPT_b) |
248 | client_config.background_if_no_lease = 1; | 244 | client_config.background_if_no_lease = 1; |
249 | if (opt & OPT_h) | 245 | if (opt & (OPT_h|OPT_H)) |
250 | client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0); | 246 | client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0); |
251 | if (opt & OPT_F) { | 247 | if (opt & OPT_F) { |
252 | client_config.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3); | 248 | client_config.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3); |
@@ -287,11 +283,6 @@ int udhcpc_main(int argc, char **argv) | |||
287 | logmode |= LOGMODE_SYSLOG; | 283 | logmode |= LOGMODE_SYSLOG; |
288 | } | 284 | } |
289 | 285 | ||
290 | #if ENABLE_FEATURE_UDHCPC_ARPING | ||
291 | if (opt & OPT_W) | ||
292 | decline_wait = xatou_range(str_W, 10, INT_MAX); | ||
293 | #endif | ||
294 | |||
295 | if (read_interface(client_config.interface, &client_config.ifindex, | 286 | if (read_interface(client_config.interface, &client_config.ifindex, |
296 | NULL, client_config.arp)) | 287 | NULL, client_config.arp)) |
297 | return 1; | 288 | return 1; |
@@ -536,7 +527,7 @@ int udhcpc_main(int argc, char **argv) | |||
536 | change_listen_mode(LISTEN_RAW); | 527 | change_listen_mode(LISTEN_RAW); |
537 | state = INIT_SELECTING; | 528 | state = INIT_SELECTING; |
538 | requested_ip = 0; | 529 | requested_ip = 0; |
539 | timeout = decline_wait; | 530 | timeout = tryagain_timeout; |
540 | packet_num = 0; | 531 | packet_num = 0; |
541 | continue; /* back to main loop */ | 532 | continue; /* back to main loop */ |
542 | } | 533 | } |