version 1.11, 2011/01/01 16:51:21 |
version 1.12, 2011/01/04 00:42:47 |
|
|
|
|
const struct cmd_entry cmd_show_options_entry = { |
const struct cmd_entry cmd_show_options_entry = { |
"show-options", "show", |
"show-options", "show", |
|
"gst:w", 0, 0, |
"[-gsw] [-t target-session|target-window]", |
"[-gsw] [-t target-session|target-window]", |
0, "gsw", |
0, |
cmd_target_init, |
NULL, |
cmd_target_parse, |
NULL, |
cmd_show_options_exec, |
cmd_show_options_exec |
cmd_target_free, |
|
cmd_target_print |
|
}; |
}; |
|
|
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 args *args = self->args; |
const struct options_table_entry *table, *oe; |
const struct options_table_entry *table, *oe; |
struct session *s; |
struct session *s; |
struct winlink *wl; |
struct winlink *wl; |
|
|
struct options_entry *o; |
struct options_entry *o; |
const char *optval; |
const char *optval; |
|
|
if (cmd_check_flag(data->chflags, 's')) { |
if (args_has(self->args, 's')) { |
oo = &global_options; |
oo = &global_options; |
table = server_options_table; |
table = server_options_table; |
} else if (cmd_check_flag(data->chflags, 'w')) { |
} else if (args_has(self->args, 'w')) { |
table = window_options_table; |
table = window_options_table; |
if (cmd_check_flag(data->chflags, 'g')) |
if (args_has(self->args, 'g')) |
oo = &global_w_options; |
oo = &global_w_options; |
else { |
else { |
wl = cmd_find_window(ctx, data->target, NULL); |
wl = cmd_find_window(ctx, args_get(args, 't'), NULL); |
if (wl == NULL) |
if (wl == NULL) |
return (-1); |
return (-1); |
oo = &wl->window->options; |
oo = &wl->window->options; |
} |
} |
} else { |
} else { |
table = session_options_table; |
table = session_options_table; |
if (cmd_check_flag(data->chflags, 'g')) |
if (args_has(self->args, 'g')) |
oo = &global_s_options; |
oo = &global_s_options; |
else { |
else { |
s = cmd_find_session(ctx, data->target); |
s = cmd_find_session(ctx, args_get(args, 't')); |
if (s == NULL) |
if (s == NULL) |
return (-1); |
return (-1); |
oo = &s->options; |
oo = &s->options; |