#include "ns.h"
#include "vrf.h"
-#include "lib/grammar_sandbox.h"
-
DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CMD, "Vtysh cmd copy")
/* Struct VTY. */
{
int len;
- if (token->cmd[0] == '\0')
+ if (token->arg[0] == '\0')
continue;
- len = strlen (token->cmd);
- if (token->cmd[0] == '.')
+ len = strlen (token->arg);
+ if (token->arg[0] == '.')
len--;
if (width < len)
for (i = 0; i < vector_active (describe); i++)
if ((token = vector_slot (describe, i)) != NULL)
{
- if (token->cmd[0] == '\0')
+ if (token->arg[0] == '\0')
continue;
if (! token->desc)
fprintf (stdout," %-s\n",
- token->cmd[0] == '.' ? token->cmd + 1 : token->cmd);
+ token->arg[0] == '.' ? token->arg + 1 : token->arg);
else
fprintf (stdout," %-*s %s\n",
width,
- token->cmd[0] == '.' ? token->cmd + 1 : token->cmd,
+ token->arg[0] == '.' ? token->arg + 1 : token->arg,
token->desc);
}
int ret = CMD_SUCCESS;
char line[100];
- sprintf(line, "show thread cpu %s\n", (argc == 4) ? argv[idx_filter] : "");
+ sprintf(line, "show thread cpu %s\n", (argc == 4) ? argv[idx_filter]->arg : "");
for (i = 0; i < array_size(vtysh_client); i++)
if ( vtysh_client[i].fd >= 0 )
{
"For the bgp daemon\n"
"For the isis daemon\n")
{
+ int idx_protocol = 2;
unsigned int i;
int ret = CMD_SUCCESS;
for (i = 0; i < array_size(vtysh_client); i++)
{
- if (begins_with(vtysh_client[i].name, argv[0]))
+ if (begins_with(vtysh_client[i].name, argv[idx_protocol]->arg))
break;
}
"Write running configuration to memory, network, or terminal\n"
"Write to terminal\n")
{
- u_int i;
- char line[] = "write terminal\n";
FILE *fp = NULL;
if (vtysh_pager_name)
"For the isis daemon\n"
"For the pim daemon\n")
{
+ int idx_protocol = 2;
unsigned int i;
int ret = CMD_SUCCESS;
for (i = 0; i < array_size(vtysh_client); i++)
{
- if (begins_with(vtysh_client[i].name, argv[0]))
+ if (begins_with(vtysh_client[i].name, argv[idx_protocol]->arg))
break;
}
"Set number of lines on a screen\n"
"Number of lines on screen (0 for no pausing)\n")
{
+ int idx_number = 2;
int lines;
char *endptr = NULL;
char default_pager[10];
- lines = strtol (argv[0], &endptr, 10);
+ lines = strtol (argv[idx_number]->arg, &endptr, 10);
if (lines < 0 || lines > 512 || *endptr != '\0')
{
vty_out (vty, "length is malformed%s", VTY_NEWLINE);
/* Execute command in child process. */
static void
-execute_command (const char *command, int argc, const char *arg1,
+execute_command (const char *command, int argc, struct cmd_token *arg1,
const char *arg2)
{
pid_t pid;
install_element (CONFIG_NODE, &vtysh_enable_password_cmd);
install_element (CONFIG_NODE, &vtysh_enable_password_text_cmd);
install_element (CONFIG_NODE, &no_vtysh_enable_password_cmd);
-
- /* grammar sandbox */
- grammar_sandbox_init();
}