summaryrefslogtreecommitdiffstats
path: root/cmd-show-options.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-01-01 16:51:21 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-01-01 16:51:21 +0000
commit3e8124009f6737c656e260b2f5b459b4ebe1a10c (patch)
treeb726a5db7cbcc8ff5d4b139be15911e46f3217c8 /cmd-show-options.c
parenta4515ce138a7c5f275a7134018cfa28c76612321 (diff)
Move the user-visible parts of all options (names, types, limit, default
values) together into one set of tables in options-table.c. Also clean up and simplify cmd-set-options.c and move a common print function into option-table.c.
Diffstat (limited to 'cmd-show-options.c')
-rw-r--r--cmd-show-options.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/cmd-show-options.c b/cmd-show-options.c
index 23838e4c..02ca91e3 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -43,20 +43,19 @@ const struct cmd_entry cmd_show_options_entry = {
int
cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
{
- struct cmd_target_data *data = self->data;
- const struct set_option_entry *table;
- struct session *s;
- struct winlink *wl;
- struct options *oo;
- struct options_entry *o;
- const struct set_option_entry *entry;
- const char *optval;
+ struct cmd_target_data *data = self->data;
+ const struct options_table_entry *table, *oe;
+ struct session *s;
+ struct winlink *wl;
+ struct options *oo;
+ struct options_entry *o;
+ const char *optval;
if (cmd_check_flag(data->chflags, 's')) {
oo = &global_options;
- table = set_option_table;
+ table = server_options_table;
} else if (cmd_check_flag(data->chflags, 'w')) {
- table = set_window_option_table;
+ table = window_options_table;
if (cmd_check_flag(data->chflags, 'g'))
oo = &global_w_options;
else {
@@ -66,7 +65,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
oo = &wl->window->options;
}
} else {
- table = set_session_option_table;
+ table = session_options_table;
if (cmd_check_flag(data->chflags, 'g'))
oo = &global_s_options;
else {
@@ -77,11 +76,11 @@ cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx)
}
}
- for (entry = table; entry->name != NULL; entry++) {
- if ((o = options_find1(oo, entry->name)) == NULL)
+ for (oe = table; oe->name != NULL; oe++) {
+ if ((o = options_find1(oo, oe->name)) == NULL)
continue;
- optval = cmd_set_option_print(entry, o);
- ctx->print(ctx, "%s %s", entry->name, optval);
+ optval = options_table_print_entry(oe, o);
+ ctx->print(ctx, "%s %s", oe->name, optval);
}
return (0);