Standardize on the vi editing directives being on the first line.
[oweals/busybox.git] / networking / ip.c
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 <stdio.h>
16 #include <stdlib.h>
17 #include <unistd.h>
18 #include <syslog.h>
19 #include <fcntl.h>
20 #include <sys/socket.h>
21 #include <netinet/in.h>
22 #include <string.h>
23
24 #include "libiproute/utils.h"
25 #include "libiproute/ip_common.h"
26
27 #include "busybox.h"
28
29 int ip_main(int argc, char **argv)
30 {
31         int ret = EXIT_FAILURE;
32
33         ip_parse_common_args(&argc, &argv);
34
35         if (argc > 1) {
36 #ifdef CONFIG_FEATURE_IP_ADDRESS
37                 if (matches(argv[1], "address") == 0) {
38                         ret = do_ipaddr(argc-2, argv+2);
39                 }
40 #endif
41 #ifdef CONFIG_FEATURE_IP_ROUTE
42                 if (matches(argv[1], "route") == 0) {
43                         ret = do_iproute(argc-2, argv+2);
44                 }
45 #endif
46 #ifdef CONFIG_FEATURE_IP_LINK
47                 if (matches(argv[1], "link") == 0) {
48                         ret = do_iplink(argc-2, argv+2);
49                 }
50 #endif
51 #ifdef CONFIG_FEATURE_IP_TUNNEL
52                 if (matches(argv[1], "tunnel") == 0 || strcmp(argv[1], "tunl") == 0) {
53                         ret = do_iptunnel(argc-2, argv+2);
54                 }
55 #endif
56         }
57         if (ret) {
58                 bb_show_usage();
59         }
60         return(EXIT_SUCCESS);
61 }