From owner-freebsd-questions Fri May 31 19:46:05 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id TAA04895 for questions-outgoing; Fri, 31 May 1996 19:46:05 -0700 (PDT) Received: from soda.CSUA.Berkeley.EDU (soda.CSUA.Berkeley.EDU [128.32.43.52]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id TAA04888 for ; Fri, 31 May 1996 19:46:01 -0700 (PDT) Received: (from richardc@localhost) by soda.CSUA.Berkeley.EDU (8.6.12/8.6.12) id TAA24134; Fri, 31 May 1996 19:45:32 -0700 Date: Fri, 31 May 1996 19:45:31 -0700 (PDT) From: Veggy Vinny To: Terry Lambert cc: terry@lambert.org, questions@freebsd.org Subject: Re: long motd files - screen pause? In-Reply-To: <199605312236.PAA19005@phaeton.artisoft.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Fri, 31 May 1996, Terry Lambert wrote: > > > 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. > > > > Hmm, but what if all the terminals were either vt100 or xterm? > > If they are vt100, then you have it set in your /etc/ttys for all of > them. Oh, okay... > If they are xterm, then you can't set vt100 in /etc/ttys for them. > > If all the vt100's are direct connect, and all the xterms are network, > then it'll work. But remote connections won't work? I wonder what did CSUA do because it works for all different terms... > > > 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*. > > > > Hmmm, okay... is the /etc/motd displayed with cat? > > It's displayed with read( fd, ...), write( 1, ...) (basically), since > it doesn't fork a command to do it, it does it itself. You need to > look at /usr/src/usr.bin/login/login.c: > > while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0) > (void)write(fileno(stdout), tbuf, nchars); > > > > > 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. > > > > Hmmm, I just wonder how it's done because all of the UC Berkeley > > machines in CSUA, OCF have the paging feature in the motd. > > It's done with an assumption of 24 lines barring other information, > just like more does it, and they modified /usr/bin/login to make it > happen. Ask them for the moidifed version. Know that under some > circumstances, you will screw up automatic logins. Know under some > circumsatnces, some users won't get all the information. Just like at > UC Berkeley. For instance, if someone come in with an 18 line xterm, > you can expect to have 8 lines per page of text that the user won't > see because it scrolled off the top of their terminal. Yep, that's true... > > > 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. > > > > Well, they'll be using rlogin, telnet and then go through their > > normal shell. > > Do you want the motd from login via rlogin paginated, or do you want the > one for the login invoked by telnetd? Which login? > > What rlogin client are you using? Does it pass the correct TERM > environment variable, according to the protocol extension RFC's? > does the rlogind understand the extensions? Is the terminal type > a valid terminal type on the machine you are telnetting from? Does > the telnetd support TERM passing via the extensions? Does the machine > you are telnetting into know about the terminal type that the user > passed into the first machine from their machine via rlogind into the > user environment? You realize that the telnet/telnetd can't correctly > communicate the number of rows, so you will need to have absolutely > accurate termcap entries with li# entries for wherever the user is > coming from? You realize that this is impossible for xterms, which > use li#24 when there is no pty used to set the stty rows via SIGWINCH > (telnet/telnetd doesn't support this)? What telnet client are you > using -- doe it even pass the TERM data to the telnetd? > > > These are the questions you must answer for yourself; they are *very* > dependent on you your site is setup and the exact versions of the > software you are using. Never knew it was that complicated. Oh well, I didn't know about the BSD news "msgs" before but I think that's the best solution. Vince