From: Michele Petrazzo - Unipex <michele.petrazzo@unipex•it>
To: netdev@vger•kernel.org
Subject: [patch] [iproute] ip exit, ip and tc line number
Date: Tue, 02 Mar 2010 19:28:41 +0100 [thread overview]
Message-ID: <4B8D58D9.7050202@unipex.it> (raw)
[-- Attachment #1: Type: text/plain, Size: 290 bytes --]
Hi,
I create a small patch that solve an annoying problem that I found on
"ip -batch" usage, so the command exits without end the parsing of the
batch file also if I specify the -force switch.
Also add the shown of the right line number where batch file fail for
both ip and tc
Michele
[-- Attachment #2: iproute.diff --]
[-- Type: text/x-diff, Size: 1476 bytes --]
commit 805fac22865d50b561643e58f5c2c001439a6a7d
Author: Michele Petrazzo <michele.petrazzo@unipex•it>
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 <michele.petrazzo@unipex•it>
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);
next reply other threads:[~2010-03-02 18:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-02 18:28 Michele Petrazzo - Unipex [this message]
2010-03-04 0:30 ` [patch] [iproute] ip exit, ip and tc line number Stephen Hemminger
2010-03-06 18:56 ` Michele Petrazzo - Unipex
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B8D58D9.7050202@unipex.it \
--to=michele.petrazzo@unipex$(echo .)it \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox