~ubuntu-branches/ubuntu/quantal/iproute/quantal

« back to all changes in this revision

Viewing changes to ip/ip.c

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2011-11-23 22:15:38 UTC
  • mfrom: (1.1.14) (23.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20111123221538-vle47e8mp5375ruq
Tags: 20111117-1
* Imported Upstream version 3.1.0 (aka snapshot 20111117)
* Update download location in debian/copyright
  - tarballs now available from kernel.org
* Drop debian/patches/xt-v6.diff, fixed upstream.
* Refresh patches: debian/patches/moo.diff and txtdocs.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
45
45
"       ip [ -force ] -batch filename\n"
46
46
"where  OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable |\n"
47
 
"                   tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm }\n"
 
47
"                   tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm |\n"
 
48
"                   netns }\n"
48
49
"       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
49
50
"                    -f[amily] { inet | inet6 | ipx | dnet | link } |\n"
50
51
"                    -l[oops] { maximum-addr-flush-attempts } |\n"
94
95
        { "xfrm",       do_xfrm },
95
96
        { "mroute",     do_multiroute },
96
97
        { "mrule",      do_multirule },
 
98
        { "netns",      do_netns },
97
99
        { "help",       do_help },
98
100
        { "moo",        do_moo }, 
99
101
        { 0 }
104
106
        const struct cmd *c;
105
107
 
106
108
        for (c = cmds; c->cmd; ++c) {
107
 
                if (matches(argv0, c->cmd) == 0)
108
 
                        return c->func(argc-1, argv+1);
 
109
                if (matches(argv0, c->cmd) == 0) {
 
110
                        return -(c->func(argc-1, argv+1));
 
111
                }
109
112
        }
110
113
 
111
114
        fprintf(stderr, "Object \"%s\" is unknown, try \"ip help\".\n", argv0);
112
 
        return -1;
 
115
        return EXIT_FAILURE;
113
116
}
114
117
 
115
118
static int batch(const char *name)
116
119
{
117
120
        char *line = NULL;
118
121
        size_t len = 0;
119
 
        int ret = 0;
 
122
        int ret = EXIT_SUCCESS;
120
123
 
121
124
        if (name && strcmp(name, "-") != 0) {
122
125
                if (freopen(name, "r", stdin) == NULL) {
123
126
                        fprintf(stderr, "Cannot open file \"%s\" for reading: %s\n",
124
127
                                name, strerror(errno));
125
 
                        return -1;
 
128
                        return EXIT_FAILURE;
126
129
                }
127
130
        }
128
131
 
129
132
        if (rtnl_open(&rth, 0) < 0) {
130
133
                fprintf(stderr, "Cannot open rtnetlink\n");
131
 
                return -1;
 
134
                return EXIT_FAILURE;
132
135
        }
133
136
 
134
137
        cmdlineno = 0;
142
145
 
143
146
                if (do_cmd(largv[0], largc, largv)) {
144
147
                        fprintf(stderr, "Command failed %s:%d\n", name, cmdlineno);
145
 
                        ret = 1;
 
148
                        ret = EXIT_FAILURE;
146
149
                        if (!force)
147
150
                                break;
148
151
                }