lib, vtysh: Rehook the motd command back into vtysh

Code was already in place to read and display a motd, but
no cli was present to make it happen.  Add the cli
back to vtysh.conf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-02-18 10:23:45 -05:00
parent 689e66945d
commit 7cfc61d32e
3 changed files with 22 additions and 5 deletions

View File

@ -4004,6 +4004,16 @@ DEFUN (no_config_log_timestamp_precision,
return CMD_SUCCESS;
}
int
cmd_banner_motd_file (const char *file)
{
if (host.motdfile)
XFREE (MTYPE_HOST, host.motdfile);
host.motdfile = XSTRDUP (MTYPE_HOST, file);
return CMD_SUCCESS;
}
DEFUN (banner_motd_file,
banner_motd_file_cmd,
"banner motd file [FILE]",
@ -4012,11 +4022,7 @@ DEFUN (banner_motd_file,
"Banner from a file\n"
"Filename\n")
{
if (host.motdfile)
XFREE (MTYPE_HOST, host.motdfile);
host.motdfile = XSTRDUP (MTYPE_HOST, argv[0]);
return CMD_SUCCESS;
return cmd_banner_motd_file (argv[0]);
}
DEFUN (banner_motd_default,

View File

@ -563,6 +563,8 @@ extern void host_config_set (const char *);
extern void print_version (const char *);
extern int cmd_banner_motd_file (const char *);
/* struct host global, ick */
extern struct host host;

View File

@ -173,6 +173,14 @@ user_get (const char *name)
return user;
}
DEFUN (banner_motd_file,
banner_motd_file_cmd,
"banner motd file [FILE]",
"\n\n\n\n")
{
return cmd_banner_motd_file (argv[0]);
}
DEFUN (username_nopassword,
username_nopassword_cmd,
"username WORD nopassword",
@ -222,4 +230,5 @@ vtysh_user_init (void)
{
userlist = list_new ();
install_element (CONFIG_NODE, &username_nopassword_cmd);
install_element (CONFIG_NODE, &banner_motd_file_cmd);
}