commit 805fac22865d50b561643e58f5c2c001439a6a7d Author: Michele Petrazzo Date: Tue Mar 2 19:12:50 2010 +0100 Resolving "ip" exit on batch usage and add to ip and tc commands the right line number on the output message then use with batch switch Signed-off-by: Michele Petrazzo diff --git a/ip/ip.c b/ip/ip.c index ace8cc6..b8c4914 100644 --- a/ip/ip.c +++ b/ip/ip.c @@ -125,6 +125,9 @@ static int batch(const char *name) if (!force) break; } + else { + lineno++; + } } if (line) free(line); diff --git a/ip/ipaddress.c b/ip/ipaddress.c index e9256d9..8ec6cfd 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -1014,7 +1014,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) } if (l && matches(d, l) != 0) { fprintf(stderr, "\"dev\" (%s) must match \"label\" (%s).\n", d, l); - exit(1); + return -1; } if (peer_len == 0 && local_len) { @@ -1079,7 +1079,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) } if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) - exit(2); + return -2; return 0; } diff --git a/tc/tc.c b/tc/tc.c index 8e362d2..ce78621 100644 --- a/tc/tc.c +++ b/tc/tc.c @@ -250,6 +250,11 @@ static int batch(const char *name) if (!force) break; } + else { + cmdlineno++; + } + + } if (line) free(line);