summaryrefslogtreecommitdiffstats
path: root/cmd-source-file.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-02-06 17:15:33 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-02-06 17:15:33 +0000
commit8aba77b7be489a93dc843d7ef4378bd73b5385b1 (patch)
tree060d27ad5846fc444116eb205f9b2b72c186717f /cmd-source-file.c
parent5e6a7c85ccdbabda01e7c05a10f7bd8dcee47e70 (diff)
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.
Diffstat (limited to 'cmd-source-file.c')
-rw-r--r--cmd-source-file.c16
1 files changed, 11 insertions, 5 deletions
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);