diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2017-02-10 17:14:50 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2017-02-10 17:14:50 +0100 |
commit | 37f9f36ec9b150474fe2347b79ccde2f41e1ec59 (patch) | |
tree | af75eb78a5dddc37658316a45c8a425c204f63b8 /lib/grammar_sandbox.c | |
parent | *: fix ambiguous commands (diff) | |
download | frr-37f9f36ec9b150474fe2347b79ccde2f41e1ec59.tar.xz frr-37f9f36ec9b150474fe2347b79ccde2f41e1ec59.zip |
grammar_sandbox: count ambiguous commands
... and make the return value useful (for vtysh)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/grammar_sandbox.c')
-rw-r--r-- | lib/grammar_sandbox.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 56733b2ec..92292fced 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -362,6 +362,7 @@ DEFUN (grammar_findambig, struct cmd_permute_item *prev = NULL, *cur = NULL; struct listnode *ln; int i, printall, scan, scannode = 0; + int ambig = 0; i = 0; printall = argv_find (argv, argc, "printall", &i); @@ -405,15 +406,20 @@ DEFUN (grammar_findambig, vty_out (vty, " %s%s '%s'%s", prev->el->name, VTY_NEWLINE, prev->el->string, VTY_NEWLINE); vty_out (vty, " %s%s '%s'%s", cur->el->name, VTY_NEWLINE, cur->el->string, VTY_NEWLINE); vty_out (vty, "%s", VTY_NEWLINE); + ambig++; } prev = cur; } list_delete (commands); + + vty_out (vty, "%s", VTY_NEWLINE); } while (scan && scannode < LINK_PARAMS_NODE); + vty_out (vty, "%d ambiguous commands found.%s", ambig, VTY_NEWLINE); + if (scan) nodegraph = NULL; - return CMD_SUCCESS; + return ambig == 0 ? CMD_SUCCESS : CMD_WARNING; } DEFUN (grammar_init_graph, |