From 8aba77b7be489a93dc843d7ef4378bd73b5385b1 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 6 Feb 2010 17:15:33 +0000 Subject: Instead of bailing out on the first configuration file error, carry on, collecting all the errors, then start with the active window in more mode displaying them. --- cmd-source-file.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'cmd-source-file.c') diff --git a/cmd-source-file.c b/cmd-source-file.c index f9ca9993..69a27e88 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -89,12 +89,18 @@ int cmd_source_file_exec(struct cmd *self, struct cmd_ctx *ctx) { struct cmd_source_file_data *data = self->data; - char *cause; + char **causes; + u_int i, ncauses; - if (load_cfg(data->path, ctx, &cause) != 0) { - ctx->error(ctx, "%s", cause); - xfree(cause); - return (-1); + causes = NULL; + ncauses = 0; + + if (load_cfg(data->path, ctx, &ncauses, &causes) != 0) { + for (i = 0; i < ncauses; i++) { + ctx->print(ctx, "%s", causes[i]); + xfree(causes[i]); + } + xfree(causes); } return (0); -- cgit v1.2.3