]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Check match level when calculating completions
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Oct 2016 00:03:39 +0000 (00:03 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Oct 2016 00:03:39 +0000 (00:03 +0000)
Adds a missing check that resulted in partial token
matches being accepted as exact matches when calculating
input completions.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/command_match.c

index 36efa3e76d205e1f6783e011e6365908a8da1442..ac6a6c813ae884eade214f4d82dce000a7e39f69 100644 (file)
@@ -328,6 +328,7 @@ command_complete (struct graph *graph,
       for (ALL_LIST_ELEMENTS_RO (current,node,gn))
         {
           struct cmd_token *token = gn->data;
+          enum match_type minmatch = min_match_level (token->type);
 #ifdef TRACE_MATCHER
           fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type);
 #endif
@@ -347,6 +348,8 @@ command_complete (struct graph *graph,
                     listnode_add (next, gn);
                     break;
                   }
+                if (minmatch > partly_match)
+                  break;
               case exact_match:
 #ifdef TRACE_MATCHER
                 fprintf (stdout, "exact_match\n");