Commit 3e4f6a38 authored by Stephen Hemminger's avatar Stephen Hemminger

Fix line numbering on batch commands

ip command should not keep track of lineno, that is done
in getcmdline().
parent 8ecdcce0
......@@ -96,7 +96,6 @@ static int batch(const char *name)
char *line = NULL;
size_t len = 0;
int ret = 0;
int lineno = 0;
if (name && strcmp(name, "-") != 0) {
if (freopen(name, "r", stdin) == NULL) {
......@@ -111,6 +110,7 @@ static int batch(const char *name)
return -1;
}
cmdlineno = 0;
while (getcmdline(&line, &len, stdin) != -1) {
char *largv[100];
int largc;
......@@ -120,7 +120,7 @@ static int batch(const char *name)
continue; /* blank line */
if (do_cmd(largv[0], largc, largv)) {
fprintf(stderr, "Command failed %s:%d\n", name, lineno);
fprintf(stderr, "Command failed %s:%d\n", name, cmdlineno);
ret = 1;
if (!force)
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment