diff options
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/command.c b/lib/command.c index af13542bc3..98ff933177 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1590,6 +1590,10 @@ permute (struct graph_node *start, struct vty *vty) static struct list *position = NULL; if (!position) position = list_new (); + struct cmd_token *stok = start->data; + struct graph_node *gnn; + struct listnode *ln; + // recursive dfs listnode_add (position, start); for (unsigned int i = 0; i < vector_active (start->to); i++) @@ -1601,8 +1605,6 @@ permute (struct graph_node *start, struct vty *vty) continue; else if (tok->type == END_TKN || gn == start) { - struct graph_node *gnn; - struct listnode *ln; vty_out (vty, " "); for (ALL_LIST_ELEMENTS_RO (position,ln,gnn)) { @@ -1615,7 +1617,15 @@ permute (struct graph_node *start, struct vty *vty) vty_out (vty, VTY_NEWLINE); } else - permute (gn, vty); + { + bool skip = false; + if (stok->type == FORK_TKN && tok->type != FORK_TKN) + for (ALL_LIST_ELEMENTS_RO (position, ln, gnn)) + if (gnn == gn && (skip = true)) + break; + if (!skip) + permute (gn, vty); + } } list_delete_node (position, listtail(position)); } |
