From owner-freebsd-bugs Wed Oct 2 13:38:51 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id NAA05042 for bugs-outgoing; Wed, 2 Oct 1996 13:38:51 -0700 (PDT) Received: from whorfin.sjca.edu (whorfin.sjca.edu [199.89.180.2]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id NAA05022 for ; Wed, 2 Oct 1996 13:38:42 -0700 (PDT) Received: from continuity.sjca.edu (continuity.sjca.edu [199.89.180.11]) by whorfin.sjca.edu (8.7.6/8.7.3) with ESMTP id QAA23442 for ; Wed, 2 Oct 1996 16:38:31 -0400 (EDT) From: Matt Braithwaite Received: (mab@localhost) by continuity.sjca.edu (8.7.5/8.6.12) id QAA00734; Wed, 2 Oct 1996 16:39:01 -0400 (EDT) Date: Wed, 2 Oct 1996 16:39:01 -0400 (EDT) Message-Id: <199610022039.QAA00734@continuity.sjca.edu> Reply-To: m-braithwaite@sjca.edu X-Organization: The Ancient Illuminated Seers of Bavaria X-Url: my homepage To: freebsd-bugs@freebsd.org Subject: suggested patch to tab initialization in tset/set.c Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk i enclose a fix for the following behavior, but i am not sure if it is the right fix. (if anyone wants to talk about it, pls. mail me directly, because i don't subscribe to -bugs). description: i have a buncha users of macintosh NCSA telnet, which can act as either a vt100 or a vt220. when they login with windows that have greater than 24 lines (most of the time), i get an undesirable behavior: the login banner, motd, and `You have new mail.' scroll from the top of the window on down with no problems. However, all of this usually occupies more than 24 lines. immediately after all of that is printed, however, the cursor is moved *back up* to the 24th line of the display, and printing continues from there. however, after login, stty returns the right window size, and no programs assume an 80x24 window. so the only real problem is corruption of the motd before the user gets a chance to read it. the jumping of the cursor to the 24th line occurs with every invocation of tset that i tried. diagnosis: tset/set.c contains the following lines (from -stable): if (set_column) tg_out = tgoto(set_column, 0, c); if (*tg_out == 'O' && set_pos) tg_out = tgoto(set_pos, c, lines - 1); if (*tg_out != 'O') tputs(tg_out, 1, outc); else (void)fprintf(stderr, "%s", " "); /* Set the tab. */ tputs(set_tab, 0, outc); but `lines' is initalized, by tgetent, to 24, earlier on, regardless of the actual size of the window. fix: i suggest *at least* the following. if the window already knows how big it is, this should override the termcap entry for purposes of setting tabs, and everything else: *** usr.bin/tset/tset.c~ Wed Oct 2 16:19:57 1996 --- usr.bin/tset/tset.c Wed Oct 2 16:20:26 1996 *************** *** 169,174 **** --- 169,178 ---- win.ws_col = columns; (void)ioctl(STDERR_FILENO, TIOCSWINSZ, &win); } + else { + lines = win.ws_row; + columns = win.ws_col; + } #endif set_control_chars(); set_conversions(usingupper); but i also think that the following would be winning. if just outputting eight spaces can do the job, there is no need for all this fancy tgoto() stuff which might put you on the last line of the display. if this happens, then the user gets n random blank lines in his login for no really good reason. *** usr.bin/tset/set.c~ Wed Oct 2 16:19:46 1996 --- usr.bin/tset/set.c Wed Oct 2 16:31:01 1996 *************** *** 301,315 **** * Get to the right column. "OOPS" is returned by * tgoto() if it can't do the job. (*snarl*) */ ! tg_out = "OOPS"; ! if (set_column) ! tg_out = tgoto(set_column, 0, c); ! if (*tg_out == 'O' && set_pos) ! tg_out = tgoto(set_pos, c, lines - 1); ! if (*tg_out != 'O') ! tputs(tg_out, 1, outc); ! else ! (void)fprintf(stderr, "%s", " "); /* Set the tab. */ tputs(set_tab, 0, outc); } --- 301,307 ---- * Get to the right column. "OOPS" is returned by * tgoto() if it can't do the job. (*snarl*) */ ! (void)fprintf(stderr, "%s", " "); /* Set the tab. */ tputs(set_tab, 0, outc); } ...but of course there'z probably stuff i don't get; so please reply to me if i have this all wrong. -- Matt Braithwaite #!/bin/perl -s-- -export-a-crypto-system-sig -RSA-3-lines-PERL http:// $m=unpack(H.$w,$m."\0"x$w),$_=`echo "16do$w 2+4Oi0$d*-^1[d2%Sa www.sjca.edu/ 2/d0