Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Feb 1999 01:16:53 -0500 (EST)
From:      "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com>
To:        vertigo@nirvanafan.com (Vertigo)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: variables in vi and ee
Message-ID:  <199902120616.BAA20430@cc942873-a.ewndsr1.nj.home.com>
In-Reply-To: <36C4AAE2.BA711393@nirvanafan.com> from Vertigo at "Feb 12, 99 10:27:47 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Vertigo wrote,
> in the editors ee and vi are there any variables that i could put in
> "motd" and it would display the users name, etc.

That would be kind of tough to do. The 'login' command is what
typically is producing the motd (I believe). If we look at the source
in my /usr/src/usr.bin/login/login.c,

void
motd(motdfile)
        char *motdfile;
{
        int fd, nchars;
        sig_t oldint;
        char tbuf[256];

        if ((fd = open(motdfile, O_RDONLY, 0)) < 0)
                return;
        motdinterrupt = 0;
        oldint = signal(SIGINT, sigint);
        while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0 && !motdinterrupt)
                (void)write(fileno(stdout), tbuf, nchars);
        (void)signal(SIGINT, oldint);
        (void)close(fd);
}

We see that the login command is spitting backout whatever is in the
motd verbatim. You could hack the login command if you are
ambitious. :) 

However, making changes to the motd automatically at startup or
periodically is quite possible. The default setup of FreeBSD does some
processing of its own on motd in /etc/rc.local and if, for some
reason, you wanted to automatically change or rotate them, cron could
be used.
-- 
Crist J. Clark                           cjclark@home.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902120616.BAA20430>