diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-06-20 11:02:28 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-06-20 11:02:28 +0100 |
commit | adca856806e5eba0bf0a505d78e29d9bd345445f (patch) | |
tree | 288203d4c8d45450aa05badd359e066fc7862265 /cmd-show-options.c | |
parent | 03945276f7010a69969714f8b581d68ee9ff92ba (diff) | |
parent | c1ede507d954b98a73c40665e7aee6fe5f0c5bce (diff) | |
download | rtmux-adca856806e5eba0bf0a505d78e29d9bd345445f.tar.gz rtmux-adca856806e5eba0bf0a505d78e29d9bd345445f.tar.bz2 rtmux-adca856806e5eba0bf0a505d78e29d9bd345445f.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-show-options.c')
-rw-r--r-- | cmd-show-options.c | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/cmd-show-options.c b/cmd-show-options.c index 8548d515..05acb608 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -84,11 +84,11 @@ cmd_show_options_exec(struct cmd *self, struct cmdq_item *item) struct options *oo; enum options_table_scope scope; char *argument, *name = NULL, *cause; - const char *target; int window, idx, ambiguous, parent; struct options_entry *o; window = (self->entry == &cmd_show_window_options_entry); + if (args->argc == 0) { scope = options_scope_from_flags(args, window, fs, &oo, &cause); if (scope == OPTIONS_TABLE_NONE) { @@ -112,49 +112,7 @@ cmd_show_options_exec(struct cmd *self, struct cmdq_item *item) cmdq_error(item, "invalid option: %s", argument); goto fail; } - if (*name == '@') - scope = options_scope_from_flags(args, window, fs, &oo, &cause); - else { - if (options_get_only(global_options, name) != NULL) - scope = OPTIONS_TABLE_SERVER; - else if (options_get_only(global_s_options, name) != NULL) - scope = OPTIONS_TABLE_SESSION; - else if (options_get_only(global_w_options, name) != NULL) - scope = OPTIONS_TABLE_WINDOW; - else { - scope = OPTIONS_TABLE_NONE; - xasprintf(&cause, "unknown option: %s", argument); - } - if (scope == OPTIONS_TABLE_SERVER) - oo = global_options; - else if (scope == OPTIONS_TABLE_SESSION) { - if (args_has(self->args, 'g')) - oo = global_s_options; - else if (s == NULL) { - target = args_get(args, 't'); - if (target != NULL) { - cmdq_error(item, "no such session: %s", - target); - } else - cmdq_error(item, "no current session"); - goto fail; - } else - oo = s->options; - } else if (scope == OPTIONS_TABLE_WINDOW) { - if (args_has(self->args, 'g')) - oo = global_w_options; - else if (wl == NULL) { - target = args_get(args, 't'); - if (target != NULL) { - cmdq_error(item, "no such window: %s", - target); - } else - cmdq_error(item, "no current window"); - goto fail; - } else - oo = wl->window->options; - } - } + scope = options_scope_from_name(args, window, name, fs, &oo, &cause); if (scope == OPTIONS_TABLE_NONE) { if (args_has(args, 'q')) goto fail; |