Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Oct 1996 16:39:01 -0400 (EDT)
From:      Matt Braithwaite <m-braithwaite@sjca.edu>
To:        freebsd-bugs@freebsd.org
Subject:   suggested patch to tab initialization in tset/set.c
Message-ID:  <199610022039.QAA00734@continuity.sjca.edu>

next in thread | raw e-mail | index | archive | help
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<X+d*La1=z\U$n%0]SX$k"[$m*]\EszlXx++p|dc`,s/^.|\W//g,print
ph/m-braithwaite pack('H*',$_)while read(STDIN,$m,($w=2*$d-1+length$n&~1)/2)



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