From: Donald Sharp Date: Tue, 1 Sep 2015 19:46:08 +0000 (-0700) Subject: Fix dryrun capability to output line # of failed read X-Git-Tag: frr-2.0-rc1~1272 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=9117f21e9805cc5f5529bb6181ca7b6ba2920968;p=matthieu%2Ffrr.git Fix dryrun capability to output line # of failed read Ticket: CM-6856 Reviewed by: CCR-3431 Testing: See bug --- diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 32df0901be..3c88ae4db5 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -669,9 +669,11 @@ vtysh_config_from_file (struct vty *vty, FILE *fp) vector vline; struct cmd_element *cmd; int save_node = CONFIG_NODE; + int lineno = 0; while (fgets (vty->buf, VTY_BUFSIZ, fp)) { + lineno++; if (vty->buf[0] == '!' || vty->buf[1] == '#') continue; @@ -725,16 +727,16 @@ vtysh_config_from_file (struct vty *vty, FILE *fp) { case CMD_WARNING: if (vty->type == VTY_FILE) - fprintf (stdout,"Warning...\n"); + fprintf (stdout,"line %d: Warning...: %s\n", lineno, vty->buf); break; case CMD_ERR_AMBIGUOUS: - fprintf (stdout,"%% Ambiguous command: %s\n", vty->buf); + fprintf (stdout,"line %d: %% Ambiguous command: %s\n", lineno, vty->buf); break; case CMD_ERR_NO_MATCH: - fprintf (stdout,"%% Unknown command: %s", vty->buf); + fprintf (stdout,"line %d: %% Unknown command: %s", lineno, vty->buf); break; case CMD_ERR_INCOMPLETE: - fprintf (stdout,"%% Command incomplete: %s\n", vty->buf); + fprintf (stdout,"line %d: %% Command incomplete: %s\n", lineno, vty->buf); break; case CMD_SUCCESS_DAEMON: {