summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cfg.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-11-19 10:38:07 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-11-19 10:38:07 +0000
commit626370e443be224485126237f266f893a45c3fc3 (patch)
tree3e127cfa64ca27657687355a7102cb899fa2073e /usr.bin/tmux/cfg.c
parentef9b90f8e9aa2aa28bdd213adde953f06fdede51 (diff)
Use a utility function for common code to show errors in config file,
from Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/cfg.c')
-rw-r--r--usr.bin/tmux/cfg.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c
index cc0a4aba8e7..b7265fafdbe 100644
--- a/usr.bin/tmux/cfg.c
+++ b/usr.bin/tmux/cfg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfg.c,v 1.16 2012/07/11 07:10:15 nicm Exp $ */
+/* $OpenBSD: cfg.c,v 1.17 2012/11/19 10:38:06 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -173,3 +173,25 @@ load_cfg(const char *path, struct cmd_ctx *ctxin, struct causelist *causes)
return (retval);
}
+
+void
+show_cfg_causes(struct session *s)
+{
+ struct window_pane *wp;
+ char *cause;
+ u_int i;
+
+ if (s == NULL || ARRAY_EMPTY(&cfg_causes))
+ return;
+
+ wp = s->curw->window->active;
+
+ window_pane_set_mode(wp, &window_copy_mode);
+ window_copy_init_for_output(wp);
+ for (i = 0; i < ARRAY_LENGTH(&cfg_causes); i++) {
+ cause = ARRAY_ITEM(&cfg_causes, i);
+ window_copy_add(wp, "%s", cause);
+ free(cause);
+ }
+ ARRAY_FREE(&cfg_causes);
+}