summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2017-07-14 07:10:13 -0400
committerGitHub <noreply@github.com>2017-07-14 07:10:13 -0400
commit79af1cb3384c47e374d118281c17a32ea03885df (patch)
tree02537ca38af0d623d43f92df48b048c9237b0cf6 /lib/vty.c
parentac45e83c04c4a5d8846c50726a2cbcf72943b8fb (diff)
parent1a0f614dd29f8666647e005c63ae00b3638234d4 (diff)
Merge pull request #808 from qlyoung/vtysh-termcols
lib, vtysh: pretty-print variable autocompletions
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 00a4e9bf71..2c25bd2fc3 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1134,17 +1134,13 @@ vty_describe_command (struct vty *vty)
vector varcomps = vector_init (VECTOR_MIN_SIZE);
cmd_variable_complete (token, ref, varcomps);
- if (vector_active(varcomps) > 0)
+ if (vector_active (varcomps) > 0)
{
- vty_out(vty, " ");
- for (size_t j = 0; j < vector_active (varcomps); j++)
- {
- char *item = vector_slot (varcomps, j);
- vty_out(vty, " %s", item);
- XFREE(MTYPE_COMPLETION, item);
- }
- vty_out (vty, VTYNL);
+ char *ac = cmd_variable_comp2str(varcomps, vty->width, VTYNL);
+ vty_outln(vty, "%s", ac);
+ XFREE(MTYPE_TMP, ac);
}
+
vector_free(varcomps);
}
#if 0