summaryrefslogtreecommitdiffstats
path: root/vtysh
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-01-23 14:15:52 +0100
committerDavid Lamparter <equinox@diac24.net>2019-02-19 14:06:01 +0100
commit1569f22439101087fdbbb572ba3e80a1b3e4b7ad (patch)
tree20e65f9cd94e405ca34ccd1c18031cce5dfa333f /vtysh
parentMerge pull request #3825 from opensourcerouting/master-isis-fix-3533 (diff)
downloadfrr-1569f22439101087fdbbb572ba3e80a1b3e4b7ad.tar.xz
frr-1569f22439101087fdbbb572ba3e80a1b3e4b7ad.zip
vtysh: fix pager compatibility handling
I just straight up forgot checking VTYSH_PAGER at startup, and the "terminal paginate" command is only installed to VIEW_NODE so it can't be processed from vtysh.conf in CONFIG_NODE... Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'vtysh')
-rw-r--r--vtysh/vtysh.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 41fd6ed7d..9ff869e50 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -104,7 +104,7 @@ static int vty_close_pager(struct vty *vty)
return 0;
}
-static void vtysh_pager_envdef(void)
+static void vtysh_pager_envdef(bool fallback)
{
char *pager_defined;
@@ -112,7 +112,7 @@ static void vtysh_pager_envdef(void)
if (pager_defined)
vtysh_pager_name = strdup(pager_defined);
- else
+ else if (fallback)
vtysh_pager_name = strdup(VTYSH_PAGER);
}
@@ -2893,7 +2893,7 @@ DEFUN (vtysh_terminal_paginate,
vtysh_pager_name = NULL;
if (strcmp(argv[0]->text, "no"))
- vtysh_pager_envdef();
+ vtysh_pager_envdef(true);
return CMD_SUCCESS;
}
@@ -2913,7 +2913,7 @@ DEFUN (vtysh_terminal_length,
if (!strcmp(argv[0]->text, "no") || !strcmp(argv[1]->text, "no")) {
/* "terminal no length" = use VTYSH_PAGER */
- vtysh_pager_envdef();
+ vtysh_pager_envdef(true);
return CMD_SUCCESS;
}
@@ -2922,7 +2922,7 @@ DEFUN (vtysh_terminal_length,
vty_out(vty,
"%% The \"terminal length\" command is deprecated and its value is ignored.\n"
"%% Please use \"terminal paginate\" instead with OS TTY length handling.\n");
- vtysh_pager_envdef();
+ vtysh_pager_envdef(true);
}
return CMD_SUCCESS;
@@ -3479,6 +3479,7 @@ void vtysh_init_vty(void)
/* set default output */
vty->of = stdout;
+ vtysh_pager_envdef(false);
/* Initialize commands. */
cmd_init(0);
@@ -3812,6 +3813,7 @@ void vtysh_init_vty(void)
/* "write memory" command. */
install_element(ENABLE_NODE, &vtysh_write_memory_cmd);
+ install_element(CONFIG_NODE, &vtysh_terminal_paginate_cmd);
install_element(VIEW_NODE, &vtysh_terminal_paginate_cmd);
install_element(VIEW_NODE, &vtysh_terminal_length_cmd);
install_element(VIEW_NODE, &vtysh_terminal_no_length_cmd);