summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-04-10 20:11:12 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-04-10 20:11:12 +0000
commit07c394e69b0cfa7cd30e97ffc6edb0d857905f45 (patch)
tree6d3ed53ff0d0edd70b66866b205a1d99c7598b11 /networking
parent99003b8a87add666e2c16a097df4da4a59310c0c (diff)
downloadbusybox-w32-07c394e69b0cfa7cd30e97ffc6edb0d857905f45.tar.gz
busybox-w32-07c394e69b0cfa7cd30e97ffc6edb0d857905f45.tar.bz2
busybox-w32-07c394e69b0cfa7cd30e97ffc6edb0d857905f45.zip
- mv ip*_main into ip.c; use a dispatcher to save on needless duplication.
Saves a minor 12b.
Diffstat (limited to 'networking')
-rw-r--r--networking/Kbuild5
-rw-r--r--networking/ip.c52
-rw-r--r--networking/ipaddr.c26
-rw-r--r--networking/iplink.c26
-rw-r--r--networking/iproute.c26
-rw-r--r--networking/iprule.c26
-rw-r--r--networking/iptunnel.c26
7 files changed, 51 insertions, 136 deletions
diff --git a/networking/Kbuild b/networking/Kbuild
index 68d36132d..13b4452bd 100644
--- a/networking/Kbuild
+++ b/networking/Kbuild
@@ -19,11 +19,6 @@ lib-$(CONFIG_IFUPDOWN) += ifupdown.o
19lib-$(CONFIG_INETD) += inetd.o 19lib-$(CONFIG_INETD) += inetd.o
20lib-$(CONFIG_IP) += ip.o 20lib-$(CONFIG_IP) += ip.o
21lib-$(CONFIG_IPCALC) += ipcalc.o 21lib-$(CONFIG_IPCALC) += ipcalc.o
22lib-$(CONFIG_IPADDR) += ipaddr.o
23lib-$(CONFIG_IPLINK) += iplink.o
24lib-$(CONFIG_IPROUTE) += iproute.o
25lib-$(CONFIG_IPRULE) += iprule.o
26lib-$(CONFIG_IPTUNNEL) += iptunnel.o
27lib-$(CONFIG_NAMEIF) += nameif.o 22lib-$(CONFIG_NAMEIF) += nameif.o
28lib-$(CONFIG_NC) += nc.o 23lib-$(CONFIG_NC) += nc.o
29lib-$(CONFIG_NETSTAT) += netstat.o 24lib-$(CONFIG_NETSTAT) += netstat.o
diff --git a/networking/ip.c b/networking/ip.c
index dc9ca1f91..dd1d863da 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -22,6 +22,57 @@ static int ATTRIBUTE_NORETURN ip_print_help(int ATTRIBUTE_UNUSED ac, char ATTRIB
22{ 22{
23 bb_show_usage(); 23 bb_show_usage();
24} 24}
25
26static int (*ip_func)(int argc, char **argv) = ip_print_help;
27
28static int ip_do(int argc, char **argv)
29{
30 ip_parse_common_args(&argc, &argv);
31 return ip_func(argc-1, argv+1);
32}
33
34#if ENABLE_FEATURE_IP_ADDRESS
35int ipaddr_main(int argc, char **argv);
36int ipaddr_main(int argc, char **argv)
37{
38 ip_func = do_ipaddr;
39 return ip_do(argc, argv);
40}
41#endif
42#if ENABLE_FEATURE_IP_LINK
43int iplink_main(int argc, char **argv);
44int iplink_main(int argc, char **argv)
45{
46 ip_func = do_iplink;
47 return ip_do(argc, argv);
48}
49#endif
50#if ENABLE_FEATURE_IP_ROUTE
51int iproute_main(int argc, char **argv);
52int iproute_main(int argc, char **argv)
53{
54 ip_func = do_iproute;
55 return ip_do(argc, argv);
56}
57#endif
58#if ENABLE_FEATURE_IP_RULE
59int iprule_main(int argc, char **argv);
60int iprule_main(int argc, char **argv)
61{
62 ip_func = do_iprule;
63 return ip_do(argc, argv);
64}
65#endif
66#if ENABLE_FEATURE_IP_TUNNEL
67int iptunnel_main(int argc, char **argv);
68int iptunnel_main(int argc, char **argv)
69{
70 ip_func = do_iptunnel;
71 return ip_do(argc, argv);
72}
73#endif
74
75
25int ip_main(int argc, char **argv); 76int ip_main(int argc, char **argv);
26int ip_main(int argc, char **argv) 77int ip_main(int argc, char **argv)
27{ 78{
@@ -41,7 +92,6 @@ int ip_main(int argc, char **argv)
41 USE_FEATURE_IP_RULE(IP_rule,) 92 USE_FEATURE_IP_RULE(IP_rule,)
42 IP_none 93 IP_none
43 }; 94 };
44 int (*ip_func)(int argc, char **argv) = ip_print_help;
45 95
46 ip_parse_common_args(&argc, &argv); 96 ip_parse_common_args(&argc, &argv);
47 if (argc > 1) { 97 if (argc > 1) {
diff --git a/networking/ipaddr.c b/networking/ipaddr.c
deleted file mode 100644
index fb0213702..000000000
--- a/networking/ipaddr.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * ip.c "ip" utility frontend.
4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 *
9 *
10 * Changes:
11 *
12 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
13 */
14
15#include "libiproute/utils.h"
16#include "libiproute/ip_common.h"
17
18#include "busybox.h"
19
20int ipaddr_main(int argc, char **argv);
21int ipaddr_main(int argc, char **argv)
22{
23 ip_parse_common_args(&argc, &argv);
24
25 return do_ipaddr(argc-1, argv+1);
26}
diff --git a/networking/iplink.c b/networking/iplink.c
deleted file mode 100644
index 54087e927..000000000
--- a/networking/iplink.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * ip.c "ip" utility frontend.
4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 *
9 *
10 * Changes:
11 *
12 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
13 */
14
15#include "libiproute/utils.h"
16#include "libiproute/ip_common.h"
17
18#include "busybox.h"
19
20int iplink_main(int argc, char **argv);
21int iplink_main(int argc, char **argv)
22{
23 ip_parse_common_args(&argc, &argv);
24
25 return do_iplink(argc-1, argv+1);
26}
diff --git a/networking/iproute.c b/networking/iproute.c
deleted file mode 100644
index 3d540b2ba..000000000
--- a/networking/iproute.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * ip.c "ip" utility frontend.
4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 *
9 *
10 * Changes:
11 *
12 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
13 */
14
15#include "libiproute/utils.h"
16#include "libiproute/ip_common.h"
17
18#include "busybox.h"
19
20int iproute_main(int argc, char **argv);
21int iproute_main(int argc, char **argv)
22{
23 ip_parse_common_args(&argc, &argv);
24
25 return do_iproute(argc-1, argv+1);
26}
diff --git a/networking/iprule.c b/networking/iprule.c
deleted file mode 100644
index 9c1fb50de..000000000
--- a/networking/iprule.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * ip.c "ip" utility frontend.
4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 *
9 *
10 * Changes:
11 *
12 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
13 */
14
15#include "libiproute/utils.h"
16#include "libiproute/ip_common.h"
17
18#include "busybox.h"
19
20int iprule_main(int argc, char **argv);
21int iprule_main(int argc, char **argv)
22{
23 ip_parse_common_args(&argc, &argv);
24
25 return do_iprule(argc-1, argv+1);
26}
diff --git a/networking/iptunnel.c b/networking/iptunnel.c
deleted file mode 100644
index 8a65413b6..000000000
--- a/networking/iptunnel.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * ip.c "ip" utility frontend.
4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 *
9 *
10 * Changes:
11 *
12 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
13 */
14
15#include "libiproute/utils.h"
16#include "libiproute/ip_common.h"
17
18#include "busybox.h"
19
20int iptunnel_main(int argc, char **argv);
21int iptunnel_main(int argc, char **argv)
22{
23 ip_parse_common_args(&argc, &argv);
24
25 return do_iptunnel(argc-1, argv+1);
26}