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:
Nicholas Marriott
2010-02-06 17:15:33 +00:00
parent 5e6a7c85cc
commit 8aba77b7be
8 changed files with 112 additions and 61 deletions

View File

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