You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
struct cli_command *cli_register_command_core(struct cli_def *cli, struct cli_command *parent, struct cli_command *c) {
if (!c) return NULL;
c->parent = parent;
// Build the 'full command name'
if (!(c->full_command_name = cli_int_command_name(cli, c))) {
cli_free_command(cli, c);
return NULL;
}
/*
* Prepend the command 'c' to the beginning of the list.
* If 'parent' is not NULL, prepend to 'parent->children'.
* Otherwise, prepend to 'cli->commands'.
*/
if (parent) {
c->next = parent->children;
if (parent->children) {
parent->children->previous = c;
}
parent->children = c;
} else {
c->next = cli->commands;
if (cli->commands) {
cli->commands->previous = c;
}
cli->commands = c;
}
c->previous = NULL; // 'c' is now the first node, so its previous is NULL
return c;
}
The text was updated successfully, but these errors were encountered:
prepend function:
The text was updated successfully, but these errors were encountered: