- mv ip*_main into ip.c; use a dispatcher to save on needless duplication.

Saves a minor 12b.
This commit is contained in:
Bernhard Reutner-Fischer 2007-04-10 20:11:12 +00:00
parent 99003b8a87
commit 07c394e69b
7 changed files with 51 additions and 136 deletions

View File

@ -19,11 +19,6 @@ lib-$(CONFIG_IFUPDOWN) += ifupdown.o
lib-$(CONFIG_INETD) += inetd.o
lib-$(CONFIG_IP) += ip.o
lib-$(CONFIG_IPCALC) += ipcalc.o
lib-$(CONFIG_IPADDR) += ipaddr.o
lib-$(CONFIG_IPLINK) += iplink.o
lib-$(CONFIG_IPROUTE) += iproute.o
lib-$(CONFIG_IPRULE) += iprule.o
lib-$(CONFIG_IPTUNNEL) += iptunnel.o
lib-$(CONFIG_NAMEIF) += nameif.o
lib-$(CONFIG_NC) += nc.o
lib-$(CONFIG_NETSTAT) += netstat.o

View File

@ -22,6 +22,57 @@ static int ATTRIBUTE_NORETURN ip_print_help(int ATTRIBUTE_UNUSED ac, char ATTRIB
{
bb_show_usage();
}
static int (*ip_func)(int argc, char **argv) = ip_print_help;
static int ip_do(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return ip_func(argc-1, argv+1);
}
#if ENABLE_FEATURE_IP_ADDRESS
int ipaddr_main(int argc, char **argv);
int ipaddr_main(int argc, char **argv)
{
ip_func = do_ipaddr;
return ip_do(argc, argv);
}
#endif
#if ENABLE_FEATURE_IP_LINK
int iplink_main(int argc, char **argv);
int iplink_main(int argc, char **argv)
{
ip_func = do_iplink;
return ip_do(argc, argv);
}
#endif
#if ENABLE_FEATURE_IP_ROUTE
int iproute_main(int argc, char **argv);
int iproute_main(int argc, char **argv)
{
ip_func = do_iproute;
return ip_do(argc, argv);
}
#endif
#if ENABLE_FEATURE_IP_RULE
int iprule_main(int argc, char **argv);
int iprule_main(int argc, char **argv)
{
ip_func = do_iprule;
return ip_do(argc, argv);
}
#endif
#if ENABLE_FEATURE_IP_TUNNEL
int iptunnel_main(int argc, char **argv);
int iptunnel_main(int argc, char **argv)
{
ip_func = do_iptunnel;
return ip_do(argc, argv);
}
#endif
int ip_main(int argc, char **argv);
int ip_main(int argc, char **argv)
{
@ -41,7 +92,6 @@ int ip_main(int argc, char **argv)
USE_FEATURE_IP_RULE(IP_rule,)
IP_none
};
int (*ip_func)(int argc, char **argv) = ip_print_help;
ip_parse_common_args(&argc, &argv);
if (argc > 1) {

View File

@ -1,26 +0,0 @@
/* 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
*/
#include "libiproute/utils.h"
#include "libiproute/ip_common.h"
#include "busybox.h"
int ipaddr_main(int argc, char **argv);
int ipaddr_main(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return do_ipaddr(argc-1, argv+1);
}

View File

@ -1,26 +0,0 @@
/* 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
*/
#include "libiproute/utils.h"
#include "libiproute/ip_common.h"
#include "busybox.h"
int iplink_main(int argc, char **argv);
int iplink_main(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return do_iplink(argc-1, argv+1);
}

View File

@ -1,26 +0,0 @@
/* 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
*/
#include "libiproute/utils.h"
#include "libiproute/ip_common.h"
#include "busybox.h"
int iproute_main(int argc, char **argv);
int iproute_main(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return do_iproute(argc-1, argv+1);
}

View File

@ -1,26 +0,0 @@
/* 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
*/
#include "libiproute/utils.h"
#include "libiproute/ip_common.h"
#include "busybox.h"
int iprule_main(int argc, char **argv);
int iprule_main(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return do_iprule(argc-1, argv+1);
}

View File

@ -1,26 +0,0 @@
/* 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
*/
#include "libiproute/utils.h"
#include "libiproute/ip_common.h"
#include "busybox.h"
int iptunnel_main(int argc, char **argv);
int iptunnel_main(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return do_iptunnel(argc-1, argv+1);
}