2004-12-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* command.c: (do_echo) Added new "echo" command, useful for
watchdog pinging to make sure the daemon is responsive.
diff --git a/lib/ChangeLog b/lib/ChangeLog
index a91901c..6eb70a2 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,4 +1,9 @@
2004-12-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+ * 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 <ajschorr@alumni.princeton.edu>
* pid_output.c: (pid_output_lock) Eliminate static function, and just
use the #ifdef to decide which version of the function to include.
diff --git a/lib/command.c b/lib/command.c
index cabdb23..2766c41 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 @@
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 @@
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 @@
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);