More removal of "#if 0" content.
[oweals/busybox.git] / networking / ip.c
1 /*
2  * ip.c         "ip" utility frontend.
3  *
4  * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
5  *
6  * Authors:     Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
7  *
8  *
9  * Changes:
10  *
11  * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
12  */
13
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <unistd.h>
17 #include <syslog.h>
18 #include <fcntl.h>
19 #include <sys/socket.h>
20 #include <netinet/in.h>
21 #include <string.h>
22
23 #include "libiproute/utils.h"
24 #include "libiproute/ip_common.h"
25
26 #include "busybox.h"
27
28 int ip_main(int argc, char **argv)
29 {
30         int ret = EXIT_FAILURE;
31
32         ip_parse_common_args(&argc, &argv);
33
34         if (argc > 1) {
35 #ifdef CONFIG_FEATURE_IP_ADDRESS
36                 if (matches(argv[1], "address") == 0) {
37                         ret = do_ipaddr(argc-2, argv+2);
38                 }
39 #endif
40 #ifdef CONFIG_FEATURE_IP_ROUTE
41                 if (matches(argv[1], "route") == 0) {
42                         ret = do_iproute(argc-2, argv+2);
43                 }
44 #endif
45 #ifdef CONFIG_FEATURE_IP_LINK
46                 if (matches(argv[1], "link") == 0) {
47                         ret = do_iplink(argc-2, argv+2);
48                 }
49 #endif
50 #ifdef CONFIG_FEATURE_IP_TUNNEL
51                 if (matches(argv[1], "tunnel") == 0 || strcmp(argv[1], "tunl") == 0) {
52                         ret = do_iptunnel(argc-2, argv+2);
53                 }
54 #endif
55         }
56         if (ret) {
57                 bb_show_usage();
58         }
59         return(EXIT_SUCCESS);
60 }