version 1.10, 2009/12/10 09:16:52 |
version 1.11, 2011/01/01 16:51:21 |
|
|
int |
int |
cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct cmd_target_data *data = self->data; |
struct cmd_target_data *data = self->data; |
const struct set_option_entry *table; |
const struct options_table_entry *table, *oe; |
struct session *s; |
struct session *s; |
struct winlink *wl; |
struct winlink *wl; |
struct options *oo; |
struct options *oo; |
struct options_entry *o; |
struct options_entry *o; |
const struct set_option_entry *entry; |
const char *optval; |
const char *optval; |
|
|
|
if (cmd_check_flag(data->chflags, 's')) { |
if (cmd_check_flag(data->chflags, 's')) { |
oo = &global_options; |
oo = &global_options; |
table = set_option_table; |
table = server_options_table; |
} else if (cmd_check_flag(data->chflags, 'w')) { |
} else if (cmd_check_flag(data->chflags, 'w')) { |
table = set_window_option_table; |
table = window_options_table; |
if (cmd_check_flag(data->chflags, 'g')) |
if (cmd_check_flag(data->chflags, 'g')) |
oo = &global_w_options; |
oo = &global_w_options; |
else { |
else { |
|
|
oo = &wl->window->options; |
oo = &wl->window->options; |
} |
} |
} else { |
} else { |
table = set_session_option_table; |
table = session_options_table; |
if (cmd_check_flag(data->chflags, 'g')) |
if (cmd_check_flag(data->chflags, 'g')) |
oo = &global_s_options; |
oo = &global_s_options; |
else { |
else { |
|
|
} |
} |
} |
} |
|
|
for (entry = table; entry->name != NULL; entry++) { |
for (oe = table; oe->name != NULL; oe++) { |
if ((o = options_find1(oo, entry->name)) == NULL) |
if ((o = options_find1(oo, oe->name)) == NULL) |
continue; |
continue; |
optval = cmd_set_option_print(entry, o); |
optval = options_table_print_entry(oe, o); |
ctx->print(ctx, "%s %s", entry->name, optval); |
ctx->print(ctx, "%s %s", oe->name, optval); |
} |
} |
|
|
return (0); |
return (0); |