summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/command.c b/lib/command.c
index 3bd578cf01..edf7348ba7 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1198,16 +1198,22 @@ static int handle_pipe_action(struct vty *vty, const char *cmd_in,
if (strmatch(token, "include")) {
/* the remaining text should be a regexp */
char *regexp = working;
+
+ if (!regexp) {
+ vty_out(vty, "%% Need a regexp to filter with\n");
+ goto fail;
+ }
+
bool succ = vty_set_include(vty, regexp);
if (!succ) {
- vty_out(vty, "%% Bad regexp '%s'", regexp);
+ vty_out(vty, "%% Bad regexp '%s'\n", regexp);
goto fail;
}
*cmd_out = XSTRDUP(MTYPE_TMP, cmd_in);
*(strstr(*cmd_out, "|")) = '\0';
} else {
- vty_out(vty, "%% Unknown action '%s'", token);
+ vty_out(vty, "%% Unknown action '%s'\n", token);
goto fail;
}
@@ -2892,6 +2898,9 @@ void cmd_terminate()
{
struct cmd_node *cmd_node;
+ hook_unregister(cmd_execute, handle_pipe_action);
+ hook_unregister(cmd_execute_done, handle_pipe_action_done);
+
if (cmdvec) {
for (unsigned int i = 0; i < vector_active(cmdvec); i++)
if ((cmd_node = vector_slot(cmdvec, i)) != NULL) {