Date: Fri, 31 May 1996 14:34:35 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: richardc@CSUA.Berkeley.EDU (Veggy Vinny) Cc: terry@lambert.org, questions@freebsd.org Subject: Re: long motd files - screen pause? Message-ID: <199605312134.OAA18765@phaeton.artisoft.com> In-Reply-To: <Pine.PTX.3.91.960531125923.29367A-100000@soda.CSUA.Berkeley.EDU> from "Veggy Vinny" at May 31, 96 01:00:11 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> > > Hmmm, okay but how do some machines make the motd pause even > > > before it knows the termcap? > > > > By assuming 24 lines or by using the telnet/rlogin/sigwinch(pty) > > hints as to terminal size (assuming they are set up correctly). > > > > On a 50 line diplay, you may get 3 "more" prompts this way. > > > > Obviously, the "more" prompts aren't reverse video (unless it hard codes > > a terminal type in /etc/ttys). > > hmmm okay... or maybe their login is modified? This is taking too much time. 8-|. You want to do something, and you are bound and determined that you be able to solve it in a way which, frankly, it is impossible to make it work reliably. You need to seek alternate soloutions, and pick one. ======================================================================== Terry's cannonical list of when you can and can't reliably use "more" during the login process: ======================================================================== 1) more needs the TERM environment variable. 2) TERM is: o set for the console in /etc/ttys o NOT set for "network" terminals, as in pty's for: o rlogin o telnet o xterm o set by forced inheritance of environment by: o xterm (sets the TERMvariable to contain a correct termcap entry for an xterm o set by name in environment (not all clients provide this information) by: o rlogin (remote TERM may not be correct, or may not be supported on host system). o telnet (remote TERM may not be correct, or may not be supported on host system). 3) more wants (but does not require, if it matches the termcap entry) stty "rows" and "cols" settings. 4) stty "rows" and "cols" settings are typically: o set for the console by the console driver o set on SIGWINCH from the master side of a pty o set by rlogin (using SIGWINCH); not supported by all clients o set by xterm (using SIGWINCH) o NOT set by telnet o NOT set for non-console terminals over wire or modem If a "rows" setting is present, it overrides the termcap setting. If it is not, the rows are assumed from the TERMCAP entry. They are set in the stty environment only after (if) login exec's a shell *AFTER* displaying the MOTD, and the shell runs a startup script, and the startup srcipt runs the X program "resize" that comes with xterm, or the shell script runs the "tset" program. So if login were to run "more" to display the /etc/motd: 1) It may not be able to inverse video the prompt, because it may or may not have a valid TERM environment variable before login has exec'ed a shell and the shell has run the startup script in the system, then the user's, home directory. This has the effect of changing the expected prompt string, which may damage the ability to reliably run automated logins. 2) It may not know the correct number of rows, either because it does not have a valid TERM environment variable (which makes "more" assume 24 rows, which may be too many, and so truncate information by scrolling it off the top), or the TERM environment variable may be set, but the stty "rows" may be incorrect, or it may not be set at all, in which case, it can truncate (via scrolling) or present multiple prompts for "more". This will cause the user to lose information in the first case, and to not be able to use automated logins in the second case. Conclusion #1: the "more" program needs information you can't be guaranteed to be able to give it until *after* you have logged in. Once you have already logged in, it is too late to use "more" to display the /etc/motd because it is a file that is displayed by login. This is how /etc/motd is *defined*. Conclusion #2: don't use the motd for information you want to potentially paginate. You can not reliably do this; it is simply impossible because you traded this ability for the ability to use terminals of various types and screen lengths on UNIX systems. Conclusion #3: in some situations, it would be "safe" for you to run "more" on the /etc/motd. You have not given us enough information about *exactly* how and what programs you let users use to login for us to be able to tell you if your situation is "safe" or not. Conclusion #4: you can use the BSD "news" program ("msgs") to do what you want without screwing around with login. You have control over what shells users are allowed to use, and you can force them to use shells that use system wide profiles to query the users for a valid terminal type and for "msgs" to be run at login time for interactive logins. This is probably the correct way to do what you say you want done. ======================================================================== Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605312134.OAA18765>