diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-05-10 13:05:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-05-10 13:05:42 +0000 |
commit | 4033c2b5604645c9eecd162975fc5b29be7cea9c (patch) | |
tree | 7b9ba812803692b8ad68ac48360179b1fae63e58 /usr.bin/tmux/cmd-show-options.c | |
parent | aec20f83b238ebc5d0d9282c3b77635c5c5c420d (diff) |
Expand formats in option names and add -F flag to do so in option values as well.
Diffstat (limited to 'usr.bin/tmux/cmd-show-options.c')
-rw-r--r-- | usr.bin/tmux/cmd-show-options.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c index 83c668b05d9..43274b0ca5a 100644 --- a/usr.bin/tmux/cmd-show-options.c +++ b/usr.bin/tmux/cmd-show-options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-options.c,v 1.41 2017/04/22 10:22:39 nicm Exp $ */ +/* $OpenBSD: cmd-show-options.c,v 1.42 2017/05/10 13:05:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -128,25 +128,36 @@ cmd_show_options_one(struct cmd *self, struct cmdq_item *item, struct options *oo) { struct args *args = self->args; + struct client *c = cmd_find_client(item, NULL, 1); + struct session *s = item->target.s; + struct winlink *wl = item->target.wl; struct options_entry *o; int idx, ambiguous; - const char *name = args->argv[0]; + char *name; + name = format_single(item, args->argv[0], c, s, wl, NULL); o = options_match_get(oo, name, &idx, 1, &ambiguous); if (o == NULL) { - if (args_has(args, 'q')) + if (args_has(args, 'q')) { + free(name); return (CMD_RETURN_NORMAL); + } if (ambiguous) { cmdq_error(item, "ambiguous option: %s", name); + free(name); return (CMD_RETURN_ERROR); } if (*name != '@' && - options_match_get(oo, name, &idx, 0, &ambiguous) != NULL) + options_match_get(oo, name, &idx, 0, &ambiguous) != NULL) { + free(name); return (CMD_RETURN_NORMAL); + } cmdq_error(item, "unknown option: %s", name); + free(name); return (CMD_RETURN_ERROR); } cmd_show_options_print(self, item, o, idx); + free(name); return (CMD_RETURN_NORMAL); } |