summaryrefslogtreecommitdiff
path: root/networking/ip.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2007-04-10 20:11:12 +0000
committerBernhard Reutner-Fischer2007-04-10 20:11:12 +0000
commit07c394e69b0cfa7cd30e97ffc6edb0d857905f45 (patch)
tree6d3ed53ff0d0edd70b66866b205a1d99c7598b11 /networking/ip.c
parent99003b8a87add666e2c16a097df4da4a59310c0c (diff)
downloadbusybox-07c394e69b0cfa7cd30e97ffc6edb0d857905f45.zip
busybox-07c394e69b0cfa7cd30e97ffc6edb0d857905f45.tar.gz
- mv ip*_main into ip.c; use a dispatcher to save on needless duplication.
Saves a minor 12b.
Diffstat (limited to 'networking/ip.c')
-rw-r--r--networking/ip.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/networking/ip.c b/networking/ip.c
index dc9ca1f..dd1d863 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
{
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) {