← Commit list

07c394e69

Bernhard Reutner-Fischer
Bernhard Reutner-Fischer
2007-04-10
FAILED Duration: 11s

Subject

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

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

networking/Kbuild+0 -5
@@ -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
networking/ip.c+51 -1
@@ -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) {
networking/ipaddr.c+0 -26
@@ -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, <[email protected]>
- *
- *
- * Changes:
- *
- * Rani Assaf <[email protected]> 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);
-}
networking/iplink.c+0 -26
@@ -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, <[email protected]>
- *
- *
- * Changes:
- *
- * Rani Assaf <[email protected]> 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);
-}
networking/iproute.c+0 -26
@@ -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, <[email protected]>
- *
- *
- * Changes:
- *
- * Rani Assaf <[email protected]> 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);
-}
networking/iprule.c+0 -26
@@ -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, <[email protected]>
- *
- *
- * Changes:
- *
- * Rani Assaf <[email protected]> 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);
-}
networking/iptunnel.c+0 -26
@@ -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, <[email protected]>
- *
- *
- * Changes:
- *
- * Rani Assaf <[email protected]> 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);
-}