From 9a53e128e82783ea59ef6d1323ae061f893b30e7 Mon Sep 17 00:00:00 2001 From: nicm 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. --- usr.bin/tmux/cmd-source-file.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'usr.bin/tmux/cmd-source-file.c') diff --git a/usr.bin/tmux/cmd-source-file.c b/usr.bin/tmux/cmd-source-file.c index 15ceb3752f2..ac2b0d67a25 100644 --- a/usr.bin/tmux/cmd-source-file.c +++ b/usr.bin/tmux/cmd-source-file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-source-file.c,v 1.7 2009/11/26 21:37:13 nicm Exp $ */ +/* $OpenBSD: cmd-source-file.c,v 1.8 2010/02/06 17:15:33 nicm Exp $ */ /* * Copyright (c) 2008 Tiago Cunha @@ -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-59-g8ed1b