summaryrefslogtreecommitdiffstats
path: root/cmd-show-options.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-05-10 16:01:10 +0100
committerThomas Adam <thomas@xteddy.org>2017-05-10 16:01:10 +0100
commit0868512bbc31a7c14ddf9f484ab7e685a1f1c3f1 (patch)
treec4fe61487f396826a602356533e9edebed965494 /cmd-show-options.c
parentf8b3f1622dcc250556599656e112a0068c75efab (diff)
parentb519551153f5451615a9d64966350400e141e540 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-show-options.c')
-rw-r--r--cmd-show-options.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/cmd-show-options.c b/cmd-show-options.c
index 382dd7fb..2dc3dee3 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -127,25 +127,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);
}