summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/vty.c b/lib/vty.c
index f8e483f6..bb3f14a5 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -216,7 +216,28 @@ vty_time_print (struct vty *vty, int cr)
void
vty_hello (struct vty *vty)
{
- if (host.motd)
+ if (host.motdfile)
+ {
+ FILE *f;
+ char buf[4096];
+ int r;
+ f = fopen (host.motdfile, "r");
+ if (f)
+ {
+ while (!feof (f))
+ {
+ memset (buf, '\0', sizeof (buf));
+ r = fread (&buf, sizeof (buf) - 1, 1, f);
+ if (r < 0)
+ break;
+ vty_out (vty, buf);
+ }
+ fclose (f);
+ }
+ else
+ vty_out (vty, "MOTD file not found\n");
+ }
+ else if (host.motd)
vty_out (vty, host.motd);
}