mirror of
https://github.com/sheumann/hush.git
synced 2024-08-21 11:28:57 +00:00
function old new delta procps_scan 1265 1298 +33 aliascmd 278 283 +5 parse_file_cmd 116 120 +4 dname_enc 373 377 +4 setcmd 90 93 +3 execcmd 57 60 +3 count_lines 72 74 +2 process_command_subs 340 339 -1 test_main 409 407 -2 mknod_main 179 177 -2 handle_incoming_and_exit 2653 2651 -2 argstr 1312 1310 -2 shiftcmd 131 128 -3 exitcmd 46 43 -3 dotcmd 297 294 -3 breakcmd 86 83 -3 evalpipe 353 349 -4 evalcommand 1180 1176 -4 evalcmd 109 105 -4 send_tree 374 369 -5 mkfifo_main 82 77 -5 evalsubshell 152 147 -5 typecmd 75 69 -6 letcmd 61 55 -6 add_cmd 1190 1183 -7 main 891 883 -8 ash_main 1415 1407 -8 parse_stream 1377 1367 -10 alloc_procps_scan 55 - -55 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148) Total: -94 bytes text data bss dec hex filename 797195 658 7428 805281 c49a1 busybox_old 797101 658 7428 805187 c4943 busybox_unstripped
124 lines
2.9 KiB
C
124 lines
2.9 KiB
C
/* vi: set sw=4 ts=4: */
|
|
/*
|
|
* ip.c "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>
|
|
*
|
|
*
|
|
* Changes:
|
|
*
|
|
* Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
|
|
* Bernhard Fischer rewrote to use index_in_substr_array
|
|
*/
|
|
|
|
#include "libbb.h"
|
|
|
|
#include "libiproute/utils.h"
|
|
#include "libiproute/ip_common.h"
|
|
|
|
#if ENABLE_FEATURE_IP_ADDRESS \
|
|
|| ENABLE_FEATURE_IP_ROUTE \
|
|
|| ENABLE_FEATURE_IP_LINK \
|
|
|| ENABLE_FEATURE_IP_TUNNEL \
|
|
|| ENABLE_FEATURE_IP_RULE
|
|
|
|
static int ATTRIBUTE_NORETURN ip_print_help(char ATTRIBUTE_UNUSED **argv)
|
|
{
|
|
bb_show_usage();
|
|
}
|
|
|
|
static int ip_do(int (*ip_func)(char **argv), char **argv)
|
|
{
|
|
argv = ip_parse_common_args(argv);
|
|
return ip_func(argv);
|
|
}
|
|
|
|
#if ENABLE_FEATURE_IP_ADDRESS
|
|
int ipaddr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|
int ipaddr_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|
{
|
|
return ip_do(do_ipaddr, argv);
|
|
}
|
|
#endif
|
|
#if ENABLE_FEATURE_IP_LINK
|
|
int iplink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|
int iplink_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|
{
|
|
return ip_do(do_iplink, argv);
|
|
}
|
|
#endif
|
|
#if ENABLE_FEATURE_IP_ROUTE
|
|
int iproute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|
int iproute_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|
{
|
|
return ip_do(do_iproute, argv);
|
|
}
|
|
#endif
|
|
#if ENABLE_FEATURE_IP_RULE
|
|
int iprule_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|
int iprule_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|
{
|
|
return ip_do(do_iprule, argv);
|
|
}
|
|
#endif
|
|
#if ENABLE_FEATURE_IP_TUNNEL
|
|
int iptunnel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|
int iptunnel_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|
{
|
|
return ip_do(do_iptunnel, argv);
|
|
}
|
|
#endif
|
|
|
|
|
|
int ip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|
int ip_main(int argc ATTRIBUTE_UNUSED, char **argv)
|
|
{
|
|
static const char keywords[] ALIGN1 =
|
|
USE_FEATURE_IP_ADDRESS("address\0")
|
|
USE_FEATURE_IP_ROUTE("route\0")
|
|
USE_FEATURE_IP_LINK("link\0")
|
|
USE_FEATURE_IP_TUNNEL("tunnel\0" "tunl\0")
|
|
USE_FEATURE_IP_RULE("rule\0")
|
|
;
|
|
enum {
|
|
USE_FEATURE_IP_ADDRESS(IP_addr,)
|
|
USE_FEATURE_IP_ROUTE(IP_route,)
|
|
USE_FEATURE_IP_LINK(IP_link,)
|
|
USE_FEATURE_IP_TUNNEL(IP_tunnel, IP_tunl,)
|
|
USE_FEATURE_IP_RULE(IP_rule,)
|
|
IP_none
|
|
};
|
|
int (*ip_func)(char**) = ip_print_help;
|
|
|
|
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
|
|
}
|
|
return ip_func(argv);
|
|
}
|
|
|
|
#endif /* any of ENABLE_FEATURE_IP_xxx is 1 */
|