udhcpc: remove -W option, -A can be reused for that
authorDenis Vlasenko <vda.linux@googlemail.com>
Thu, 22 Nov 2007 21:41:14 +0000 (21:41 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Thu, 22 Nov 2007 21:41:14 +0000 (21:41 -0000)
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

include/usage.h
networking/udhcp/dhcpc.c

index 5c03719d6d0c9cd1b4e37483e8be38167f4ba075..15ef44ab128b12caec7d79c755c0c94a08554a8a 100644 (file)
@@ -3856,10 +3856,10 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l      Prints names of all matching files even when
        "\n     -C,--clientid-none      Suppress default client identifier" \
        "\n     -p,--pidfile=file       Create pidfile" \
        "\n     -r,--request=IP         IP address to request" \
-       "\n     -s,--script=file        Run file at dhcp events (default: /usr/share/udhcpc/default.script)" \
+       "\n     -s,--script=file        Run file at dhcp events (default /usr/share/udhcpc/default.script)" \
        "\n     -t,--retries=N          Send up to N request packets" \
        "\n     -T,--timeout=N          Try to get a lease for N seconds (default 3)" \
-       "\n     -A,--tryagain=N         Wait N seconds (default 60) after failure" \
+       "\n     -A,--tryagain=N         Wait N seconds (default 20) after failure" \
        "\n     -f,--foreground Run in foreground" \
        "\n     -b,--background Background if lease is not immediately obtained" \
        "\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
        "\n     -R,--release    Release IP on quit" \
        USE_FEATURE_UDHCPC_ARPING( \
        "\n     -a,--arping     Use arping to validate offered address" \
-       "\n     -W,--wait=N     Wait N seconds after declining (default 10)" \
        ) \
        ) \
        SKIP_GETOPT_LONG( \
@@ -3879,10 +3878,10 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l      Prints names of all matching files even when
        "\n     -C              Suppress default client identifier" \
        "\n     -p file         Create pidfile" \
        "\n     -r IP           IP address to request" \
-       "\n     -s file         Run file at dhcp events (default: /usr/share/udhcpc/default.script)" \
+       "\n     -s file         Run file at dhcp events (default /usr/share/udhcpc/default.script)" \
        "\n     -t N            Send up to N request packets" \
        "\n     -T N            Try to get a lease for N seconds (default 3)" \
-       "\n     -A N            Wait N seconds (default 60) after failure" \
+       "\n     -A N            Wait N seconds (default 20) after failure" \
        "\n     -f              Run in foreground" \
        "\n     -b              Background if lease is not immediately obtained" \
        "\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
        "\n     -R              Release IP on quit" \
        USE_FEATURE_UDHCPC_ARPING( \
        "\n     -a              Use arping to validate offered address" \
-       "\n     -W N            Wait N seconds after declining (default 10)" \
        ) \
        )
 
@@ -3921,17 +3919,17 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l      Prints names of all matching files even when
        "$ umount /dev/hdc1\n"
 
 #define uname_trivial_usage \
-       "[OPTION]..."
+       "[-amnrspv]"
 #define uname_full_usage \
-       "Print certain system information. With no OPTION, same as -s." \
+       "Print system information." \
        "\n\nOptions:\n" \
-       "       -a      Print all information\n" \
+       "       -a      Print all\n" \
        "       -m      The machine (hardware) type\n" \
-       "       -n      Print machine's hostname\n" \
-       "       -r      Print OS release\n" \
-       "       -s      Print OS name\n" \
-       "       -p      Print host processor type\n" \
-       "       -v      Print OS version"
+       "       -n      Hostname\n" \
+       "       -r      OS release\n" \
+       "       -s      OS name (default)\n" \
+       "       -p      Processor type\n" \
+       "       -v      OS version"
 #define uname_example_usage \
        "$ uname -a\n" \
        "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
        "Uncompress .Z file[s]" \
        "\n\nOptions:\n" \
        "       -c      Extract to stdout\n" \
-       "       -f      Force overwrite an existing file"
+       "       -f      Overwrite an existing file"
 
 #define unexpand_trivial_usage \
        "[-f][-a][-t NUM] [FILE|-]"
index 234ecfd135f8f7a75d32a2b912d39a31bb59ee5c..6ade1ee341a274fab90a59a4004d7f3c92278955 100644 (file)
@@ -145,13 +145,12 @@ int udhcpc_main(int argc, char **argv)
 {
        uint8_t *temp, *message;
        char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_A, *str_t;
-       int tryagain_timeout = 60;
-       int discover_timeout = 3;
-       int discover_retries = 3;
 #if ENABLE_FEATURE_UDHCPC_ARPING
-       int decline_wait = 10;
        char *str_W;
 #endif
+       int tryagain_timeout = 20;
+       int discover_timeout = 3;
+       int discover_retries = 3;
        uint32_t xid = 0;
        uint32_t lease_seconds = 0; /* can be given as 32-bit quantity */
        unsigned t1 = 0, t2 = 0; /* what a wonderful names */
@@ -199,7 +198,6 @@ int udhcpc_main(int argc, char **argv)
                "foreground\0"    No_argument       "f"
                "background\0"    No_argument       "b"
                "hostname\0"      Required_argument "H"
-               "hostname\0"      Required_argument "h"
                "fqdn\0"          Required_argument "F"
                "interface\0"     Required_argument "i"
                "now\0"           No_argument       "n"
@@ -215,7 +213,6 @@ int udhcpc_main(int argc, char **argv)
                "syslog\0"        No_argument       "S"
 #if ENABLE_FEATURE_UDHCPC_ARPING
                "arping\0"        No_argument       "a"
-               "wait\0"          Required_argument "W"
 #endif
                ;
 #endif
@@ -224,8 +221,7 @@ int udhcpc_main(int argc, char **argv)
        client_config.script = DEFAULT_SCRIPT;
 
        /* Parse command line */
-       opt_complementary = "c--C:C--c" // mutually exclusive
-                           ":hH:Hh"; // -h and -H are the same
+       opt_complementary = "c--C:C--c"; // mutually exclusive
 #if ENABLE_GETOPT_LONG
        applet_long_options = udhcpc_longopts;
 #endif
@@ -246,7 +242,7 @@ int udhcpc_main(int argc, char **argv)
                client_config.foreground = 1;
        if (opt & OPT_b)
                client_config.background_if_no_lease = 1;
-       if (opt & OPT_h)
+       if (opt & (OPT_h|OPT_H))
                client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
        if (opt & OPT_F) {
                client_config.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3);
@@ -287,11 +283,6 @@ int udhcpc_main(int argc, char **argv)
                logmode |= LOGMODE_SYSLOG;
        }
 
-#if ENABLE_FEATURE_UDHCPC_ARPING
-       if (opt & OPT_W)
-               decline_wait = xatou_range(str_W, 10, INT_MAX);
-#endif
-
        if (read_interface(client_config.interface, &client_config.ifindex,
                           NULL, client_config.arp))
                return 1;
@@ -536,7 +527,7 @@ int udhcpc_main(int argc, char **argv)
                                                        change_listen_mode(LISTEN_RAW);
                                                        state = INIT_SELECTING;
                                                        requested_ip = 0;
-                                                       timeout = decline_wait;
+                                                       timeout = tryagain_timeout;
                                                        packet_num = 0;
                                                        continue; /* back to main loop */
                                                }