version 1.89, 2015/12/12 18:32:24 |
version 1.90, 2015/12/13 14:32:38 |
|
|
const struct cmd_entry cmd_set_option_entry = { |
const struct cmd_entry cmd_set_option_entry = { |
"set-option", "set", |
"set-option", "set", |
"agoqst:uw", 1, 2, |
"agoqst:uw", 1, 2, |
"[-agosquw] [-t target-session|target-window] option [value]", |
"[-agosquw] [-t target-window] option [value]", |
0, |
CMD_WINDOW_T|CMD_CANFAIL, |
cmd_set_option_exec |
cmd_set_option_exec |
}; |
}; |
|
|
|
|
"set-window-option", "setw", |
"set-window-option", "setw", |
"agoqt:u", 1, 2, |
"agoqt:u", 1, 2, |
"[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", |
"[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", |
0, |
CMD_WINDOW_T|CMD_CANFAIL, |
cmd_set_option_exec |
cmd_set_option_exec |
}; |
}; |
|
|
|
|
cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) |
cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
const struct options_table_entry *oe; |
struct session *s = cmdq->state.tflag.s; |
struct session *s; |
struct winlink *wl = cmdq->state.tflag.wl; |
struct winlink *wl; |
struct window *w; |
struct client *c; |
struct client *c; |
|
const struct options_table_entry *oe; |
struct options *oo; |
struct options *oo; |
struct window *w; |
|
const char *optstr, *valstr; |
const char *optstr, *valstr; |
|
|
/* Get the option name and value. */ |
/* Get the option name and value. */ |
|
|
if (args_has(self->args, 'g')) |
if (args_has(self->args, 'g')) |
oo = global_w_options; |
oo = global_w_options; |
else { |
else { |
wl = cmd_find_window(cmdq, args_get(args, 't'), NULL); |
|
if (wl == NULL) { |
if (wl == NULL) { |
cmdq_error(cmdq, |
cmdq_error(cmdq, |
"couldn't set '%s'%s", optstr, |
"couldn't set '%s'%s", optstr, |
|
|
if (args_has(self->args, 'g')) |
if (args_has(self->args, 'g')) |
oo = global_s_options; |
oo = global_s_options; |
else { |
else { |
s = cmd_find_session(cmdq, args_get(args, 't'), 0); |
|
if (s == NULL) { |
if (s == NULL) { |
cmdq_error(cmdq, |
cmdq_error(cmdq, |
"couldn't set '%s'%s", optstr, |
"couldn't set '%s'%s", optstr, |
|
|
const char *valstr) |
const char *valstr) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct session *s; |
struct session *s = cmdq->state.tflag.s; |
struct winlink *wl; |
struct winlink *wl = cmdq->state.tflag.wl; |
struct options *oo; |
struct options *oo; |
|
|
if (args_has(args, 's')) |
if (args_has(args, 's')) |
|
|
self->entry == &cmd_set_window_option_entry) { |
self->entry == &cmd_set_window_option_entry) { |
if (args_has(self->args, 'g')) |
if (args_has(self->args, 'g')) |
oo = global_w_options; |
oo = global_w_options; |
else { |
else |
wl = cmd_find_window(cmdq, args_get(args, 't'), NULL); |
|
if (wl == NULL) |
|
return (CMD_RETURN_ERROR); |
|
oo = wl->window->options; |
oo = wl->window->options; |
} |
|
} else { |
} else { |
if (args_has(self->args, 'g')) |
if (args_has(self->args, 'g')) |
oo = global_s_options; |
oo = global_s_options; |
else { |
else |
s = cmd_find_session(cmdq, args_get(args, 't'), 0); |
|
if (s == NULL) |
|
return (CMD_RETURN_ERROR); |
|
oo = s->options; |
oo = s->options; |
} |
|
} |
} |
|
|
if (args_has(args, 'u')) { |
if (args_has(args, 'u')) { |