=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-show-options.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- src/usr.bin/tmux/cmd-show-options.c 2019/06/20 07:10:56 1.54 +++ src/usr.bin/tmux/cmd-show-options.c 2019/06/20 07:41:29 1.55 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-options.c,v 1.54 2019/06/20 07:10:56 nicm Exp $ */ +/* $OpenBSD: cmd-show-options.c,v 1.55 2019/06/20 07:41:29 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -85,11 +85,11 @@ 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) { @@ -113,49 +113,7 @@ 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;