summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-01-18 08:40:51 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-01-18 08:40:51 +0000
commitdfabb8445505aea0b6df6ea613920f7669fc61e7 (patch)
tree4e10f0b001f2663ff14b005f771c4e38d3f056f4
parentfe60d8c08aa9ffc18f3dd54b0eae9bba40049f18 (diff)
options_match needs to explicitly check for user options.
-rw-r--r--usr.bin/tmux/cmd-show-options.c5
-rw-r--r--usr.bin/tmux/options.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c
index 0fb4fc1dc49..3dd353225e5 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.36 2017/01/16 14:49:14 nicm Exp $ */
+/* $OpenBSD: cmd-show-options.c,v 1.37 2017/01/18 08:40:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -131,7 +131,8 @@ cmd_show_options_one(struct cmd *self, struct cmdq_item *item,
cmdq_error(item, "ambiguous option: %s", name);
return (CMD_RETURN_ERROR);
}
- if (options_match_get(oo, name, &idx, 0, &ambiguous) != NULL)
+ if (*name != '@' &&
+ options_match_get(oo, name, &idx, 0, &ambiguous) != NULL)
return (CMD_RETURN_NORMAL);
cmdq_error(item, "unknown option: %s", name);
return (CMD_RETURN_ERROR);
diff --git a/usr.bin/tmux/options.c b/usr.bin/tmux/options.c
index a70db4e9201..9abee080e6a 100644
--- a/usr.bin/tmux/options.c
+++ b/usr.bin/tmux/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.28 2017/01/16 23:45:08 nicm Exp $ */
+/* $OpenBSD: options.c,v 1.29 2017/01/18 08:40:50 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -403,6 +403,12 @@ options_match(const char *s, int *idx, int* ambiguous)
name = options_parse(s, idx);
namelen = strlen(name);
+ *idx = -1;
+ if (*name == '@') {
+ *ambiguous = 0;
+ return (xstrdup(name));
+ }
+
found = NULL;
for (oe = options_table; oe->name != NULL; oe++) {
if (strcmp(oe->name, name) == 0) {