DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command desc")
-#define MAXDEPTH 64
-
/** headers **/
void grammar_sandbox_init(void);
void pretty_print_graph(struct vty *vty, struct graph_node *, int, int,
vty_out(vty, "%% No match\n");
// free resources
- list_delete(completions);
+ list_delete_and_null(&completions);
cmd_free_strvec(command);
XFREE(MTYPE_TMP, cmdstr);
vty_out(vty, "func: %p\n", element->func);
- list_delete(argvv);
+ list_delete_and_null(&argvv);
} else {
assert(MATCHER_ERROR(result));
switch (result) {
{
check_nodegraph();
- struct graph_node *stack[MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
pretty_print_graph(vty, vector_slot(nodegraph->nodes, 0), 0, argc >= 3,
stack, 0);
return CMD_SUCCESS;
{
check_nodegraph();
- struct graph_node *stack[MAXDEPTH];
- struct graph_node *visited[MAXDEPTH * MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
+ struct graph_node *visited[CMD_ARGC_MAX * CMD_ARGC_MAX];
size_t vpos = 0;
FILE *ofd = fopen(argv[2]->arg, "w");
return;
}
- if (++stackpos == MAXDEPTH)
+ if (++stackpos == CMD_ARGC_MAX)
return;
for (i = 0; i < vector_active(gn->to); i++) {
static struct list *cmd_graph_permutations(struct graph *graph)
{
char accumulate[2048] = "";
- struct graph_node *stack[MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
struct list *rv = list_new();
rv->cmp = cmd_permute_cmp;
nodegraph = cnode->cmdgraph;
if (!nodegraph)
continue;
- vty_out(vty, "scanning node %d\n", scannode - 1);
+ vty_out(vty, "scanning node %d (%s)\n", scannode - 1,
+ node_names[scannode - 1]);
}
commands = cmd_graph_permutations(nodegraph);
}
prev = cur;
}
- list_delete(commands);
+ list_delete_and_null(&commands);
vty_out(vty, "\n");
} while (scan && scannode < LINK_PARAMS_NODE);
item(IPV4_PREFIX_TKN), // IPV4 network prefixes
item(IPV6_TKN), // IPV6 prefixes
item(IPV6_PREFIX_TKN), // IPV6 network prefixes
+ item(MAC_TKN), // MAC address
+ item(MAC_PREFIX_TKN), // MAC address w/ mask
/* plumbing types */
item(FORK_TKN),
vty_out(vty, " ?'%s'", tok->desc);
vty_out(vty, " ");
- if (stackpos == MAXDEPTH) {
+ if (stackpos == CMD_ARGC_MAX) {
vty_out(vty, " -aborting! (depth limit)\n");
return;
}
if (visited[i] == start)
return;
visited[(*visitpos)++] = start;
- if ((*visitpos) == MAXDEPTH * MAXDEPTH)
+ if ((*visitpos) == CMD_ARGC_MAX * CMD_ARGC_MAX)
return;
snprintf(tokennum, sizeof(tokennum), "%d?", tok->type);
}
fprintf(ofd, ">, style = filled, fillcolor = \"%s\" ];\n", color);
- if (stackpos == MAXDEPTH)
+ if (stackpos == CMD_ARGC_MAX)
return;
stack[stackpos++] = start;