]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Fix '?'-completion dereferences in vtysh
authorQuentin Young <qlyoung@cumulusnetworks.com>
Sat, 1 Oct 2016 01:03:24 +0000 (01:03 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Sat, 1 Oct 2016 01:03:24 +0000 (01:03 +0000)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
vtysh/vtysh.c

index 53f63256beb8ff0d9526a9bf014bccb66ad2cbce..de973cf4cefa53a97bace0a0bfa53f19ddfb9e4b 100644 (file)
@@ -823,32 +823,25 @@ vtysh_rl_describe (void)
   for (i = 0; i < vector_active (describe); i++)
     if ((token = vector_slot (describe, i)) != NULL)
       {
-       int len;
-
-       if (token->arg[0] == '\0')
-         continue;
+        if (token->text[0] == '\0')
+          continue;
 
-       len = strlen (token->arg);
-       if (token->arg[0] == '.')
-         len--;
+        int len = strlen (token->text);
 
-       if (width < len)
-         width = len;
+        if (width < len)
+          width = len;
       }
 
   for (i = 0; i < vector_active (describe); i++)
     if ((token = vector_slot (describe, i)) != NULL)
       {
-       if (token->arg[0] == '\0')
-         continue;
-
        if (! token->desc)
          fprintf (stdout,"  %-s\n",
-                  token->arg[0] == '.' ? token->arg + 1 : token->arg);
+                  token->text);
        else
          fprintf (stdout,"  %-*s  %s\n",
                   width,
-                  token->arg[0] == '.' ? token->arg + 1 : token->arg,
+                  token->text,
                   token->desc);
       }