diff options
author | Denys Vlasenko | 2010-07-25 00:13:27 +0200 |
---|---|---|
committer | Denys Vlasenko | 2010-07-25 00:13:27 +0200 |
commit | 503a07cab24a1e58099a04970babd2b761469449 (patch) | |
tree | f96b01fd405adcbcbeed0086389da27bd1a07ccc /networking | |
parent | b2d95147c989448f23cc59c63b83e2d89f0bd9cd (diff) | |
download | busybox-503a07cab24a1e58099a04970babd2b761469449.zip busybox-503a07cab24a1e58099a04970babd2b761469449.tar.gz |
Apply post-1.17.0 fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/ip.c | 62 | ||||
-rw-r--r-- | networking/nc.c | 2 | ||||
-rw-r--r-- | networking/wget.c | 2 |
3 files changed, 25 insertions, 41 deletions
diff --git a/networking/ip.c b/networking/ip.c index 7a0f308..3a99fa3 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -1,14 +1,12 @@ /* vi: set sw=4 ts=4: */ /* - * ip.c "ip" utility frontend. + * "ip" utility frontend. * * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. * - * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> - * + * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> * * Changes: - * * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses * Bernhard Reutner-Fischer rewrote to use index_in_substr_array */ @@ -24,12 +22,14 @@ || ENABLE_FEATURE_IP_TUNNEL \ || ENABLE_FEATURE_IP_RULE -static int NORETURN ip_print_help(char **argv UNUSED_PARAM) +static int ip_print_help(char **argv UNUSED_PARAM) { bb_show_usage(); } -static int ip_do(int (*ip_func)(char **argv), char **argv) +typedef int (*ip_func_ptr_t)(char**); + +static int ip_do(ip_func_ptr_t ip_func, char **argv) { argv = ip_parse_common_args(argv + 1); return ip_func(argv); @@ -78,45 +78,29 @@ int ip_main(int argc UNUSED_PARAM, char **argv) static const char keywords[] ALIGN1 = IF_FEATURE_IP_ADDRESS("address\0") IF_FEATURE_IP_ROUTE("route\0") + IF_FEATURE_IP_ROUTE("r\0") IF_FEATURE_IP_LINK("link\0") - IF_FEATURE_IP_TUNNEL("tunnel\0" "tunl\0") + IF_FEATURE_IP_TUNNEL("tunnel\0") + IF_FEATURE_IP_TUNNEL("tunl\0") IF_FEATURE_IP_RULE("rule\0") ; - enum { - IF_FEATURE_IP_ADDRESS(IP_addr,) - IF_FEATURE_IP_ROUTE(IP_route,) - IF_FEATURE_IP_LINK(IP_link,) - IF_FEATURE_IP_TUNNEL(IP_tunnel, IP_tunl,) - IF_FEATURE_IP_RULE(IP_rule,) - IP_none + static const ip_func_ptr_t ip_func_ptrs[] = { + ip_print_help, + IF_FEATURE_IP_ADDRESS(do_ipaddr,) + IF_FEATURE_IP_ROUTE(do_iproute,) + IF_FEATURE_IP_ROUTE(do_iproute,) + IF_FEATURE_IP_LINK(do_iplink,) + IF_FEATURE_IP_TUNNEL(do_iptunnel,) + IF_FEATURE_IP_TUNNEL(do_iptunnel,) + IF_FEATURE_IP_RULE(do_iprule,) }; - int (*ip_func)(char**) = ip_print_help; + ip_func_ptr_t ip_func; + int key; argv = ip_parse_common_args(argv + 1); - if (*argv) { - int key = index_in_substrings(keywords, *argv); - argv++; -#if ENABLE_FEATURE_IP_ADDRESS - if (key == IP_addr) - ip_func = do_ipaddr; -#endif -#if ENABLE_FEATURE_IP_ROUTE - if (key == IP_route) - ip_func = do_iproute; -#endif -#if ENABLE_FEATURE_IP_LINK - if (key == IP_link) - ip_func = do_iplink; -#endif -#if ENABLE_FEATURE_IP_TUNNEL - if (key == IP_tunnel || key == IP_tunl) - ip_func = do_iptunnel; -#endif -#if ENABLE_FEATURE_IP_RULE - if (key == IP_rule) - ip_func = do_iprule; -#endif - } + key = *argv ? index_in_substrings(keywords, *argv++) : -1; + ip_func = ip_func_ptrs[key + 1]; + return ip_func(argv); } diff --git a/networking/nc.c b/networking/nc.c index 0dacaf1..c771374 100644 --- a/networking/nc.c +++ b/networking/nc.c @@ -34,7 +34,7 @@ //config: //config:config NC_110_COMPAT //config: bool "Netcat 1.10 compatibility (+2.5k)" -//config: default y +//config: default n # off specially for Rob //config: depends on NC //config: help //config: This option makes nc closely follow original nc-1.10. diff --git a/networking/wget.c b/networking/wget.c index f55b68a..1f35f8b 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -50,7 +50,7 @@ static void progress_meter(int flag) } bb_progress_update(&G.pmt, G.curfile, G.beg_range, G.transferred, - G.chunked ? 0 : G.content_len + G.beg_range); + G.chunked ? 0 : G.beg_range + G.transferred + G.content_len); if (flag == 0) { /* last call to progress_meter */ |