From: Stephen Hemminger Date: Thu, 4 Mar 2010 00:31:09 +0000 (-0800) Subject: Fix line numbering on batch commands X-Git-Tag: v4.13.0~1475 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=3e4f6a380a14a3100b1aa97a94c46d8712080863;p=mirror_iproute2.git Fix line numbering on batch commands ip command should not keep track of lineno, that is done in getcmdline(). --- diff --git a/ip/ip.c b/ip/ip.c index ace8cc6f..5ebd2158 100644 --- 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;