From 373541104b745f58a5d6eaba81444cf1ccb0e595 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 18 Jan 2017 08:40:50 +0000 Subject: [PATCH 1/2] options_match needs to explicitly check for user options. --- cmd-show-options.c | 3 ++- options.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd-show-options.c b/cmd-show-options.c index b9bfe5ee..5929e915 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -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/options.c b/options.c index 9c260e26..0375c0a4 100644 --- a/options.c +++ b/options.c @@ -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) { From 649c0d8e91e799981f4e41d4268a3470512c8412 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 18 Jan 2017 08:43:21 +0000 Subject: [PATCH 2/2] Do not reset idx, it has just been set. --- options.c | 1 - 1 file changed, 1 deletion(-) diff --git a/options.c b/options.c index 0375c0a4..4f6aa6fe 100644 --- a/options.c +++ b/options.c @@ -403,7 +403,6 @@ 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));