summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/command.c5
-rw-r--r--vtysh/vtysh.c8
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/command.c b/lib/command.c
index 770e2fc5a..d2798b500 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2226,18 +2226,19 @@ DEFUN (no_banner_motd,
DEFUN(find,
find_cmd,
- "find REGEX",
+ "find REGEX...",
"Find CLI command matching a regular expression\n"
"Search pattern (POSIX regex)\n")
{
- char *pattern = argv[1]->arg;
const struct cmd_node *node;
const struct cmd_element *cli;
vector clis;
regex_t exp = {};
+ char *pattern = argv_concat(argv, argc, 1);
int cr = regcomp(&exp, pattern, REG_NOSUB | REG_EXTENDED);
+ XFREE(MTYPE_TMP, pattern);
if (cr != 0) {
switch (cr) {
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 376418829..839d5dd1e 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -3719,19 +3719,19 @@ DEFUN (no_vtysh_output_file,
DEFUN(find,
find_cmd,
- "find REGEX",
+ "find REGEX...",
"Find CLI command matching a regular expression\n"
"Search pattern (POSIX regex)\n")
{
- char *pattern = argv[1]->arg;
const struct cmd_node *node;
const struct cmd_element *cli;
vector clis;
-
regex_t exp = {};
-
+ char *pattern = argv_concat(argv, argc, 1);
int cr = regcomp(&exp, pattern, REG_NOSUB | REG_EXTENDED);
+ XFREE(MTYPE_TMP, pattern);
+
if (cr != 0) {
switch (cr) {
case REG_BADBR: