From 2885f72d546a9d4673e4b9a607f8e30ab2e88cc9 Mon Sep 17 00:00:00 2001 From: ajs Date: Fri, 17 Dec 2004 23:16:33 +0000 Subject: 2004-12-17 Andrew J. Schorr * command.c: (do_echo) Added new "echo" command, useful for watchdog pinging to make sure the daemon is responsive. --- lib/ChangeLog | 5 +++++ lib/command.c | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/ChangeLog b/lib/ChangeLog index a91901cd..6eb70a22 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2004-12-17 Andrew J. Schorr + + * command.c: (do_echo) Added new "echo" command, useful for + watchdog pinging to make sure the daemon is responsive. + 2004-12-17 Andrew J. Schorr * pid_output.c: (pid_output_lock) Eliminate static function, and just diff --git a/lib/command.c b/lib/command.c index cabdb237..2766c414 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1,5 +1,5 @@ /* - $Id: command.c,v 1.29 2004/12/07 17:15:56 ajs Exp $ + $Id: command.c,v 1.30 2004/12/17 23:16:33 ajs Exp $ Command interpreter routine for virtual terminal [aka TeletYpe] Copyright (C) 1997, 98, 99 Kunihiro Ishiguro @@ -2995,6 +2995,19 @@ DEFUN (no_service_terminal_length, no_service_terminal_length_cmd, return CMD_SUCCESS; } +DEFUN_HIDDEN (do_echo, + echo_cmd, + "echo .MESSAGE", + "Echo a message back to the vty\n" + "The message to echo\n") +{ + char *message; + + vty_out (vty, "%s%s",(message = argv_concat(argv, argc, 0)), VTY_NEWLINE); + XFREE(MTYPE_TMP, message); + return CMD_SUCCESS; +} + DEFUN (config_logmsg, config_logmsg_cmd, "logmsg "LOG_LEVELS" .MESSAGE", @@ -3465,6 +3478,7 @@ cmd_init (int terminal) install_element (VIEW_NODE, &config_terminal_length_cmd); install_element (VIEW_NODE, &config_terminal_no_length_cmd); install_element (VIEW_NODE, &show_logging_cmd); + install_element (VIEW_NODE, &echo_cmd); } if (terminal) @@ -3482,6 +3496,7 @@ cmd_init (int terminal) install_element (ENABLE_NODE, &config_terminal_length_cmd); install_element (ENABLE_NODE, &config_terminal_no_length_cmd); install_element (ENABLE_NODE, &show_logging_cmd); + install_element (ENABLE_NODE, &echo_cmd); install_element (ENABLE_NODE, &config_logmsg_cmd); install_default (CONFIG_NODE); -- cgit v1.2.1