summaryrefslogtreecommitdiffstats
path: root/vtysh
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2013-09-30 12:27:51 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2014-04-01 20:21:41 +0200
commitcd40b329a2e4da882bcad0431c048c876bbeafbd (patch)
treecfbdec5a7559c6d3e56766797896a18809aa1746 /vtysh
parente712d0e3667ffad8109ef8bce3ce01927ee95bb7 (diff)
downloadquagga-cd40b329a2e4da882bcad0431c048c876bbeafbd.tar.bz2
quagga-cd40b329a2e4da882bcad0431c048c876bbeafbd.tar.xz
lib/command.c: rewrite command matching/parsing
Add support for keyword commands. Includes new documentation for DEFUN() in lib/command.h, for preexisting features as well as new keyword specification. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'vtysh')
-rw-r--r--vtysh/vtysh.c22
-rw-r--r--vtysh/vtysh_main.c2
2 files changed, 11 insertions, 13 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index c575902c..34c3bd62 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -554,7 +554,7 @@ vtysh_rl_describe (void)
vector vline;
vector describe;
int width;
- struct desc *desc;
+ struct cmd_token *token;
vline = cmd_make_strvec (rl_line_buffer);
@@ -592,15 +592,15 @@ vtysh_rl_describe (void)
/* Get width of command string. */
width = 0;
for (i = 0; i < vector_active (describe); i++)
- if ((desc = vector_slot (describe, i)) != NULL)
+ if ((token = vector_slot (describe, i)) != NULL)
{
int len;
- if (desc->cmd[0] == '\0')
+ if (token->cmd[0] == '\0')
continue;
- len = strlen (desc->cmd);
- if (desc->cmd[0] == '.')
+ len = strlen (token->cmd);
+ if (token->cmd[0] == '.')
len--;
if (width < len)
@@ -608,19 +608,19 @@ vtysh_rl_describe (void)
}
for (i = 0; i < vector_active (describe); i++)
- if ((desc = vector_slot (describe, i)) != NULL)
+ if ((token = vector_slot (describe, i)) != NULL)
{
- if (desc->cmd[0] == '\0')
+ if (token->cmd[0] == '\0')
continue;
- if (! desc->str)
+ if (! token->desc)
fprintf (stdout," %-s\n",
- desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd);
+ token->cmd[0] == '.' ? token->cmd + 1 : token->cmd);
else
fprintf (stdout," %-*s %s\n",
width,
- desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd,
- desc->str);
+ token->cmd[0] == '.' ? token->cmd + 1 : token->cmd,
+ token->desc);
}
cmd_free_strvec (vline);
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c
index 4a315a5c..48958f0f 100644
--- a/vtysh/vtysh_main.c
+++ b/vtysh/vtysh_main.c
@@ -299,8 +299,6 @@ main (int argc, char **argv, char **env)
vty_init_vtysh ();
- sort_node ();
-
/* Read vtysh configuration file before connecting to daemons. */
vtysh_read_config (config_default);