]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
Fix line numbering on batch commands
authorStephen Hemminger <stephen.hemminger@vyatta.com>
Thu, 4 Mar 2010 00:31:09 +0000 (16:31 -0800)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Thu, 4 Mar 2010 00:31:09 +0000 (16:31 -0800)
ip command should not keep track of lineno, that is done
in getcmdline().

ip/ip.c

diff --git a/ip/ip.c b/ip/ip.c
index ace8cc6f5e402a82beeaf2c3c505122637ce78a2..5ebd215817b99d7a1732160f9e4477eb1d674be5 100644 (file)
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -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;