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.
This commit is contained in:
Tiago Cunha
2010-02-08 18:10:07 +00:00
parent 676d0809d2
commit a32d095c97
8 changed files with 120 additions and 70 deletions

View File

@ -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);