diff options
author | Tiago Cunha <tcunha@gmx.com> | 2010-02-08 18:10:07 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2010-02-08 18:10:07 +0000 |
commit | a32d095c97177eaa7ba7d2a3c723df1b878e9922 (patch) | |
tree | e67b2e8974142e2eec1d28bf8d146cdba647cadd /cmd-source-file.c | |
parent | 676d0809d2ecd38df0a135d505106f53cbed17fc (diff) |
Sync OpenBSD patchset 635:
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.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/cmd-source-file.c b/cmd-source-file.c index 9c3a5641..c97eff63 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -1,4 +1,4 @@ -/* $Id: cmd-source-file.c,v 1.11 2009-11-28 14:50:36 tcunha Exp $ */ +/* $Id: cmd-source-file.c,v 1.12 2010-02-08 18:10:07 tcunha Exp $ */ /* * Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org> @@ -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); |