version 1.86, 2015/11/18 14:27:44 |
version 1.87, 2015/11/20 12:01:19 |
|
|
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 *table, *oe; |
const struct options_table_entry *oe; |
struct session *s; |
struct session *s; |
struct winlink *wl; |
struct winlink *wl; |
struct client *c; |
struct client *c; |
|
|
return (cmd_set_option_user(self, cmdq, optstr, valstr)); |
return (cmd_set_option_user(self, cmdq, optstr, valstr)); |
|
|
/* Find the option entry, try each table. */ |
/* Find the option entry, try each table. */ |
table = oe = NULL; |
oe = NULL; |
if (options_table_find(optstr, &table, &oe) != 0) { |
if (options_table_find(optstr, &oe) != 0) { |
if (!args_has(args, 'q')) { |
if (!args_has(args, 'q')) { |
cmdq_error(cmdq, "ambiguous option: %s", optstr); |
cmdq_error(cmdq, "ambiguous option: %s", optstr); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
|
|
return (CMD_RETURN_NORMAL); |
return (CMD_RETURN_NORMAL); |
} |
} |
|
|
/* Work out the tree from the table. */ |
/* Work out the tree from the scope of the option. */ |
if (table == server_options_table) |
if (oe->scope == OPTIONS_TABLE_SERVER) |
oo = global_options; |
oo = global_options; |
else if (table == window_options_table) { |
else if (oe->scope == OPTIONS_TABLE_WINDOW) { |
if (args_has(self->args, 'g')) |
if (args_has(self->args, 'g')) |
oo = global_w_options; |
oo = global_w_options; |
else { |
else { |
|
|
} |
} |
oo = wl->window->options; |
oo = wl->window->options; |
} |
} |
} else if (table == session_options_table) { |
} else if (oe->scope == OPTIONS_TABLE_SESSION) { |
if (args_has(self->args, 'g')) |
if (args_has(self->args, 'g')) |
oo = global_s_options; |
oo = global_s_options; |
else { |
else { |