summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-set-option.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-11-20 12:01:20 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-11-20 12:01:20 +0000
commitef3ab27410d76fe9f38d1a96f056dde7466bc5df (patch)
tree4d3443ee87edc86431739c14d6f307b142b22123 /usr.bin/tmux/cmd-set-option.c
parent8dc236f4e4dc42ddbbb6007780e7ebef5f6b24e5 (diff)
Instead of separate tables for different types of options, give each
option a scope type (server, session, window) in one table.
Diffstat (limited to 'usr.bin/tmux/cmd-set-option.c')
-rw-r--r--usr.bin/tmux/cmd-set-option.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index 6e7d94c1f88..b6a26b05b68 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.86 2015/11/18 14:27:44 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.87 2015/11/20 12:01:19 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -84,7 +84,7 @@ enum cmd_retval
cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
- const struct options_table_entry *table, *oe;
+ const struct options_table_entry *oe;
struct session *s;
struct winlink *wl;
struct client *c;
@@ -108,8 +108,8 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
return (cmd_set_option_user(self, cmdq, optstr, valstr));
/* Find the option entry, try each table. */
- table = oe = NULL;
- if (options_table_find(optstr, &table, &oe) != 0) {
+ oe = NULL;
+ if (options_table_find(optstr, &oe) != 0) {
if (!args_has(args, 'q')) {
cmdq_error(cmdq, "ambiguous option: %s", optstr);
return (CMD_RETURN_ERROR);
@@ -124,10 +124,10 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_NORMAL);
}
- /* Work out the tree from the table. */
- if (table == server_options_table)
+ /* Work out the tree from the scope of the option. */
+ if (oe->scope == OPTIONS_TABLE_SERVER)
oo = global_options;
- else if (table == window_options_table) {
+ else if (oe->scope == OPTIONS_TABLE_WINDOW) {
if (args_has(self->args, 'g'))
oo = global_w_options;
else {
@@ -141,7 +141,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
}
oo = wl->window->options;
}
- } else if (table == session_options_table) {
+ } else if (oe->scope == OPTIONS_TABLE_SESSION) {
if (args_has(self->args, 'g'))
oo = global_s_options;
else {