summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-07-05 15:10:39 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-07-05 15:10:39 +0000
commitf5b03bf9816ac419cf655eacd37b3708a312b7ff (patch)
treeccb5bc8071f8dbfc15c6af07ad340aa783180847 /usr.bin
parent859a61c8e3f3d9df5f092fe7bdf172d3f8231600 (diff)
Clarify error messages when setting options, from Thomas Adam.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-set-option.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index bd801c1a7c5..a8a25a22145 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.61 2013/03/24 09:55:02 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.62 2013/07/05 15:10:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -128,8 +128,13 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
oo = &global_w_options;
else {
wl = cmd_find_window(cmdq, args_get(args, 't'), NULL);
- if (wl == NULL)
+ if (wl == NULL) {
+ cmdq_error(cmdq,
+ "couldn't set '%s'%s", optstr,
+ (!args_has(args, 't') && !args_has(args,
+ 'g')) ? " need target window or -g" : "");
return (CMD_RETURN_ERROR);
+ }
oo = &wl->window->options;
}
} else if (table == session_options_table) {
@@ -137,8 +142,13 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
oo = &global_s_options;
else {
s = cmd_find_session(cmdq, args_get(args, 't'), 0);
- if (s == NULL)
+ if (s == NULL) {
+ cmdq_error(cmdq,
+ "couldn't set '%s'%s", optstr,
+ (!args_has(args, 't') && !args_has(args,
+ 'g')) ? " need target session or -g" : "");
return (CMD_RETURN_ERROR);
+ }
oo = &s->options;
}
} else {