From owner-freebsd-questions Thu Feb 11 22:15:22 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA25915 for freebsd-questions-outgoing; Thu, 11 Feb 1999 22:15:22 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from cc942873-a.ewndsr1.nj.home.com (cc942873-a.ewndsr1.nj.home.com [24.2.89.207]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA25910 for ; Thu, 11 Feb 1999 22:15:20 -0800 (PST) (envelope-from cjc@cc942873-a.ewndsr1.nj.home.com) Received: (from cjc@localhost) by cc942873-a.ewndsr1.nj.home.com (8.8.8/8.8.8) id BAA20430; Fri, 12 Feb 1999 01:16:54 -0500 (EST) (envelope-from cjc) From: "Crist J. Clark" Message-Id: <199902120616.BAA20430@cc942873-a.ewndsr1.nj.home.com> Subject: Re: variables in vi and ee In-Reply-To: <36C4AAE2.BA711393@nirvanafan.com> from Vertigo at "Feb 12, 99 10:27:47 pm" To: vertigo@nirvanafan.com (Vertigo) Date: Fri, 12 Feb 1999 01:16:53 -0500 (EST) Cc: freebsd-questions@FreeBSD.ORG Reply-To: cjclark@home.com X-Mailer: ELM [version 2.4ME+ PL40 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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