summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-source-file.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2010-02-06 17:15:33 +0000
committernicm <nicm@openbsd.org>2010-02-06 17:15:33 +0000
commit9a53e128e82783ea59ef6d1323ae061f893b30e7 (patch)
tree73d3f8459a72afb2915c00727c817b42d2bf3e7c /usr.bin/tmux/cmd-source-file.c
parentwhen receiving the first message of an rsn group key handshake (diff)
downloadwireguard-openbsd-9a53e128e82783ea59ef6d1323ae061f893b30e7.tar.xz
wireguard-openbsd-9a53e128e82783ea59ef6d1323ae061f893b30e7.zip
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 'usr.bin/tmux/cmd-source-file.c')
-rw-r--r--usr.bin/tmux/cmd-source-file.c18
1 files changed, 12 insertions, 6 deletions
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 <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);