aboutsummaryrefslogtreecommitdiff
path: root/cmd-show-options.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-01-03 23:52:38 +0000
committerTiago Cunha <tcunha@gmx.com>2011-01-03 23:52:38 +0000
commit36c7c7537a218ec83661b529d9f3340842f8497e (patch)
tree703d5f3033e3cb158f4e4d5dad627bcdbd181d73 /cmd-show-options.c
parent2bdae526ad07254a9eb0101b5811291329eb0fac (diff)
downloadrtmux-36c7c7537a218ec83661b529d9f3340842f8497e.tar.gz
rtmux-36c7c7537a218ec83661b529d9f3340842f8497e.tar.bz2
rtmux-36c7c7537a218ec83661b529d9f3340842f8497e.zip
Sync OpenBSD patchset 826:
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.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/cmd-show-options.c b/cmd-show-options.c
index 50b3ffe9..6c4c89a5 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-options.c,v 1.21 2009-12-10 16:59:02 tcunha Exp $ */
+/* $Id: cmd-show-options.c,v 1.22 2011-01-03 23:52:38 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);