=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/options.c,v retrieving revision 1.50 retrieving revision 1.51 diff -c -r1.50 -r1.51 *** src/usr.bin/tmux/options.c 2019/06/20 11:59:59 1.50 --- src/usr.bin/tmux/options.c 2019/06/20 18:13:04 1.51 *************** *** 1,4 **** ! /* $OpenBSD: options.c,v 1.50 2019/06/20 11:59:59 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: options.c,v 1.51 2019/06/20 18:13:04 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott *************** *** 741,747 **** struct window_pane *wp = fs->wp; const char *target = args_get(args, 't'); const struct options_table_entry *oe; ! int scope; if (*name == '@') return (options_scope_from_flags(args, window, fs, oo, cause)); --- 741,747 ---- struct window_pane *wp = fs->wp; const char *target = args_get(args, 't'); const struct options_table_entry *oe; ! int scope = OPTIONS_TABLE_NONE; if (*name == '@') return (options_scope_from_flags(args, window, fs, oo, cause)); *************** *** 754,774 **** xasprintf(cause, "unknown option: %s", name); return (OPTIONS_TABLE_NONE); } ! scope = oe->scope; ! ! switch (scope) { case OPTIONS_TABLE_SERVER: *oo = global_options; break; case OPTIONS_TABLE_SESSION: ! if (args_has(args, 'g')) *oo = global_s_options; ! else if (s == NULL && target != NULL) xasprintf(cause, "no such session: %s", target); else if (s == NULL) xasprintf(cause, "no current session"); ! else *oo = s->options; break; case OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE: if (args_has(args, 'p')) { --- 754,776 ---- xasprintf(cause, "unknown option: %s", name); return (OPTIONS_TABLE_NONE); } ! switch (oe->scope) { case OPTIONS_TABLE_SERVER: *oo = global_options; + scope = OPTIONS_TABLE_SERVER; break; case OPTIONS_TABLE_SESSION: ! if (args_has(args, 'g')) { *oo = global_s_options; ! scope = OPTIONS_TABLE_SESSION; ! } else if (s == NULL && target != NULL) xasprintf(cause, "no such session: %s", target); else if (s == NULL) xasprintf(cause, "no current session"); ! else { *oo = s->options; + scope = OPTIONS_TABLE_SESSION; + } break; case OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE: if (args_has(args, 'p')) { *************** *** 776,796 **** xasprintf(cause, "no such pane: %s", target); else if (wp == NULL) xasprintf(cause, "no current pane"); ! else *oo = wp->options; break; } scope = OPTIONS_TABLE_WINDOW; /* FALLTHROUGH */ case OPTIONS_TABLE_WINDOW: ! if (args_has(args, 'g')) *oo = global_w_options; ! else if (wl == NULL && target != NULL) xasprintf(cause, "no such window: %s", target); else if (wl == NULL) xasprintf(cause, "no current window"); ! else *oo = wl->window->options; break; } return (scope); --- 778,803 ---- xasprintf(cause, "no such pane: %s", target); else if (wp == NULL) xasprintf(cause, "no current pane"); ! else { *oo = wp->options; + scope = OPTIONS_TABLE_PANE; + } break; } scope = OPTIONS_TABLE_WINDOW; /* FALLTHROUGH */ case OPTIONS_TABLE_WINDOW: ! if (args_has(args, 'g')) { *oo = global_w_options; ! scope = OPTIONS_TABLE_WINDOW; ! } else if (wl == NULL && target != NULL) xasprintf(cause, "no such window: %s", target); else if (wl == NULL) xasprintf(cause, "no current window"); ! else { *oo = wl->window->options; + scope = OPTIONS_TABLE_WINDOW; + } break; } return (scope);