]> git.puffer.fish Git - matthieu/frr.git/commitdiff
vtysh: fixed compile errors
authorDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 30 Sep 2016 16:10:28 +0000 (16:10 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 30 Sep 2016 16:10:28 +0000 (16:10 +0000)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
vtysh/extract.pl.in
vtysh/vtysh.c
vtysh/vtysh_user.c

index b7533881a30b0eee3ff6288cc757fd6f2fdd6842..e777039b346c50bf433f46c4cfb91bdba4b6e871 100755 (executable)
@@ -212,7 +212,7 @@ foreach (@ARGV) {
     }
 }
 
-my $bad_cli_stomps = 108;
+my $bad_cli_stomps = 71;
 # Currently we have $bad_cli_stomps.  This was determined by
 # running this script and counting up the collisions from what
 # was returned.
index ec94c37d66fc7260b12567c0d8e2d8640e5d385b..8f0a7fd551f03357d89f8fffab440c5e6d9e5aff 100644 (file)
@@ -44,8 +44,6 @@
 #include "ns.h"
 #include "vrf.h"
 
-#include "lib/grammar_sandbox.h"
-
 DEFINE_MTYPE_STATIC(MVTYSH, VTYSH_CMD, "Vtysh cmd copy")
 
 /* Struct VTY. */
@@ -827,11 +825,11 @@ vtysh_rl_describe (void)
       {
        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)
@@ -841,16 +839,16 @@ vtysh_rl_describe (void)
   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);
       }
 
@@ -1737,7 +1735,7 @@ DEFUN (vtysh_show_thread,
   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 )
       {
@@ -1784,12 +1782,13 @@ DEFUN (vtysh_show_work_queues_daemon,
        "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;
     }
 
@@ -2177,8 +2176,6 @@ DEFUN (vtysh_write_terminal,
        "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)
@@ -2233,12 +2230,13 @@ DEFUN (vtysh_write_terminal_daemon,
        "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;
     }
 
@@ -2437,11 +2435,12 @@ DEFUN (vtysh_terminal_length,
        "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);
@@ -2498,7 +2497,7 @@ DEFUN (vtysh_show_daemons,
 
 /* 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;
@@ -3185,7 +3184,4 @@ vtysh_init_vty (void)
   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();
 }
index 1886ba3a67b2380f36794a08a67ca30e3207b62d..b1ba1a24aecf083aa8a8b045cf5dbe605ebfae39 100644 (file)
@@ -173,7 +173,8 @@ DEFUN (banner_motd_file,
        "Banner from a file\n"
        "Filename\n")
 {
-  return cmd_banner_motd_file (argv[0]);
+  int idx_file = 3;
+  return cmd_banner_motd_file (argv[idx_file]->arg);
 }
 
 DEFUN (username_nopassword,
@@ -183,8 +184,9 @@ DEFUN (username_nopassword,
        "\n"
        "\n")
 {
+  int idx_word = 1;
   struct vtysh_user *user;
-  user = user_get (argv[0]);
+  user = user_get (argv[idx_word]->arg);
   user->nopassword = 1;
   return CMD_SUCCESS;
 }