diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-12-13 16:01:13 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-12-13 16:01:13 +0000 |
commit | ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4 (patch) | |
tree | 72ebffc1c0617c28ddc421f24045f148b7d59e36 /cmd-set-option.c | |
parent | 92f187d1c2d84322860dc595da604260999a52f0 (diff) | |
parent | ff599f4004aaa6aae325ece5cbc996e2dc6f0b4f (diff) | |
download | rtmux-ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4.tar.gz rtmux-ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4.tar.bz2 rtmux-ae5ddfdc1ae471f13c6d0e94ff4029d4fb29e1f4.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-set-option.c')
-rw-r--r-- | cmd-set-option.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c index daee62ac..86856fbb 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -67,8 +67,8 @@ struct options_entry *cmd_set_option_style(struct cmd *, struct cmd_q *, const struct cmd_entry cmd_set_option_entry = { "set-option", "set", "agoqst:uw", 1, 2, - "[-agosquw] [-t target-session|target-window] option [value]", - 0, + "[-agosquw] [-t target-window] option [value]", + CMD_WINDOW_T|CMD_CANFAIL, cmd_set_option_exec }; @@ -76,7 +76,7 @@ const struct cmd_entry cmd_set_window_option_entry = { "set-window-option", "setw", "agoqt:u", 1, 2, "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", - 0, + CMD_WINDOW_T|CMD_CANFAIL, cmd_set_option_exec }; @@ -84,12 +84,12 @@ enum cmd_retval cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - const struct options_table_entry *oe; - struct session *s; - struct winlink *wl; + struct session *s = cmdq->state.tflag.s; + struct winlink *wl = cmdq->state.tflag.wl; + struct window *w; struct client *c; + const struct options_table_entry *oe; struct options *oo; - struct window *w; const char *optstr, *valstr; /* Get the option name and value. */ @@ -131,7 +131,6 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) if (args_has(self->args, 'g')) oo = global_w_options; else { - wl = cmd_find_window(cmdq, args_get(args, 't'), NULL); if (wl == NULL) { cmdq_error(cmdq, "couldn't set '%s'%s", optstr, @@ -145,7 +144,6 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) if (args_has(self->args, 'g')) oo = global_s_options; else { - s = cmd_find_session(cmdq, args_get(args, 't'), 0); if (s == NULL) { cmdq_error(cmdq, "couldn't set '%s'%s", optstr, @@ -209,8 +207,8 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr, const char *valstr) { struct args *args = self->args; - struct session *s; - struct winlink *wl; + struct session *s = cmdq->state.tflag.s; + struct winlink *wl = cmdq->state.tflag.wl; struct options *oo; if (args_has(args, 's')) @@ -219,21 +217,13 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char *optstr, self->entry == &cmd_set_window_option_entry) { if (args_has(self->args, 'g')) oo = global_w_options; - else { - wl = cmd_find_window(cmdq, args_get(args, 't'), NULL); - if (wl == NULL) - return (CMD_RETURN_ERROR); + else oo = wl->window->options; - } } else { if (args_has(self->args, 'g')) oo = global_s_options; - else { - s = cmd_find_session(cmdq, args_get(args, 't'), 0); - if (s == NULL) - return (CMD_RETURN_ERROR); + else oo = s->options; - } } if (args_has(args, 'u')) { |