summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorSteve Hill <quagga@cheesy.sackheads.org>2009-07-28 16:36:14 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-09-01 12:44:10 -0700
commit13fbc82d86811ec2f53b7c925bda151eb4caf4e5 (patch)
treebd24dfa9e43e49840af5f0d9a04a3c224430b4d3 /lib/command.c
parentc8a96aef3e1fb2025f3fb0f37cc4a0a75b72a0e7 (diff)
lib: Improve error reporting from broken config files
* command.h: (config_from_file) Add variable to interface for line number reporting. * command.c: (config_from_file) Set & increment 'line_num' while parsing. * vty.c: (vty_read_file) Report parse errors in the correct order to stderr, with added line numbers. Conflicts: lib/command.c lib/vty.c Integrated in changes made to continue loading code even after failure to read a line in properly as part of this cherry-pick
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/command.c b/lib/command.c
index e7027fca26..ff3778bd70 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2777,14 +2777,18 @@ cmd_execute_command_strict (vector vline, struct vty *vty,
/* Configuration make from file. */
int
-config_from_file (struct vty *vty, FILE *fp)
+config_from_file (struct vty *vty, FILE *fp, unsigned int *line_num)
{
int ret, error_ret=0;
int saved_node;
+ *line_num = 0;
vector vline;
while (fgets (vty->buf, VTY_BUFSIZ, fp))
{
+ if (!error_ret)
+ ++(*line_num);
+
vline = cmd_make_strvec (vty->buf);
/* In case of comment line */