summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-11-16 15:00:52 +0900
committerDavid Lamparter <equinox@opensourcerouting.org>2016-12-01 17:25:56 +0100
commit0b84f294904959a4be58db6fe0e89d71b2c1f401 (patch)
treef52c765644294f314ede33506f29b6888439b904 /lib/command.c
parent0577b824e137f143c899a567b1bbeb109841c796 (diff)
*: make DEFUN installations file-local
This moves all install_element calls into the file where the DEFUNs are located. This fixes several small related bugs: - ospf6d wasn't installing a "no interface FOO" command - zebra had a useless copy of "interface FOO" - pimd's copy of "interface FOO" was not setting qobj_index, which means "description LINE" commands would fail with an error The next commit will do the actual act of making "foo_cmd" static. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/lib/command.c b/lib/command.c
index 3c429ce1a7..8e935acf92 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1051,6 +1051,13 @@ DEFUN (config_exit,
"exit",
"Exit current mode and down to previous mode\n")
{
+ cmd_exit (vty);
+ return CMD_SUCCESS;
+}
+
+void
+cmd_exit (struct vty *vty)
+{
switch (vty->node)
{
case VIEW_NODE:
@@ -1118,7 +1125,6 @@ DEFUN (config_exit,
default:
break;
}
- return CMD_SUCCESS;
}
/* ALIAS_FIXME */
@@ -1264,17 +1270,12 @@ permute (struct graph_node *start, struct vty *vty)
list_delete_node (position, listtail(position));
}
-/* Help display function for all node. */
-DEFUN (config_list,
- config_list_cmd,
- "list [permutations]",
- "Print command list\n"
- "Print all possible command permutations\n")
+int
+cmd_list_cmds (struct vty *vty, int do_permute)
{
struct cmd_node *node = vector_slot (cmdvec, vty->node);
- if ((strmatch (argv[0]->text, "list") && argc == 2) ||
- (strmatch (argv[0]->text, "show") && argc == 3))
+ if (do_permute)
permute (vector_slot (node->cmdgraph->nodes, 0), vty);
else
{
@@ -1289,13 +1290,23 @@ DEFUN (config_list,
return CMD_SUCCESS;
}
+/* Help display function for all node. */
+DEFUN (config_list,
+ config_list_cmd,
+ "list [permutations]",
+ "Print command list\n"
+ "Print all possible command permutations\n")
+{
+ return cmd_list_cmds (vty, argc == 2);
+}
+
DEFUN (show_commandtree,
show_commandtree_cmd,
"show commandtree [permutations]",
SHOW_STR
"Show command tree\n")
{
- return config_list (self, vty, argc, argv);
+ return cmd_list_cmds (vty, argc == 3);
}
/* Write current configuration into file. */
@@ -2352,10 +2363,8 @@ cmd_init (int terminal)
install_element (ENABLE_NODE, &config_logmsg_cmd);
install_default (CONFIG_NODE);
- install_element (VIEW_NODE, &show_thread_cpu_cmd);
- install_element (ENABLE_NODE, &clear_thread_cpu_cmd);
-
- install_element (VIEW_NODE, &show_work_queues_cmd);
+ thread_cmd_init ();
+ workqueue_cmd_init ();
}
install_element (CONFIG_NODE, &hostname_cmd);