]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib, vtysh: re-add support for spaces in 'find'
authorQuentin Young <qlyoung@nvidia.com>
Thu, 18 Mar 2021 19:31:35 +0000 (15:31 -0400)
committerQuentin Young <qlyoung@nvidia.com>
Wed, 7 Apr 2021 17:39:56 +0000 (13:39 -0400)
Lost ability to handle them in the regex patch

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
lib/command.c
vtysh/vtysh.c

index 770e2fc5ace68d625fcea2ba2e6dca79af2cbdf6..d2798b500227de6cc7cad288d106d1d71e3808fc 100644 (file)
@@ -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) {
index 3764188292a8d013f52e0fa93dab72e74bd9f874..839d5dd1eceede38fc0acdc2ea717626db2c471d 100644 (file)
@@ -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: