[net.news.b] Fixes to vnews terminal handler

ka@spanky.UUCP (Kenneth Almquist) (09/21/83)

There are two problems with the virtterm terminal handler included with
vnews.  The first is that it doesn't handle the ti/te capabilities
correctly.  A diff of the changes required to fix this is given below.
Before you install this change, be sure that your termcap file is not
referring to the the ti capability by the name "ts".  The name ti is
correct according to the 4.1 BSD manual.

The second problem is that the arguments to the cs macro may be in the
wrong order for your termcap entry.  Vnews passes the top line of the
region as the first parameter and the bottom line as the second.  Now
my understanding is that the termcap entry for the vt100 provided with
4.1 BSD will only work if the arguments are given in the order used by
vnews but the termcap entry for the vt100 provided with 4.1C will only
work if the arguments are given in the reverse order from the order
used by vnews.  Since the 4.1 manual is completely silent on the order
of arguments to the cs parameter, I don't know which is correct.  So
if your termcap won't work with vnews, change either termcap or
virtterm.c as  you prefer.
					Kenneth Almquist


----------------------------
34c34
< #define TS _tstr[18]		/* start cursor mode */
---
> #define TI _tstr[18]		/* start cursor mode */
41c41
< static char sname[] = "hoclcdceupdousuebtbcaldlcmchcvcssfsrtstetacrpc";
---
> static char sname[] = "hoclcdceupdousuebtbcaldlcmchcvcssfsrtitetacrpc";
856,857c856,857
< 	if (TS != NULL)
< 		tputs(TS, 0, vputc);
---
> 	if (TI != NULL)
> 		tputs(TI, 0, vputc);
862,863c862,865
< 	if (TE != NULL)
< 		tputs(TE, 0, vputc);
---
> 	if (TE != NULL) {
> 		tputs(TE, 0, vputc);
> 		vflush() ;
> 	}

guy@rlgvax.UUCP (Guy Harris) (09/22/83)

It was mentioned in net.news.b that the "cs" string is used inconsistently
in 4.1BSD "termcap" and 4.1c "termcap"; in 4.1 the "cs" string for the VT100
has a "%r" in it while in 4.1c it doesn't.

The order problem is probably due to the fact that the arguments to "tgoto" are
"column, line", but most terminals put the line in the cursor motion string
first and the column next, so "tgoto" puts the arguments out in reverse
order.  Therefore, using "tgoto" on the "cs" string requires you to pass the
arguments in the order "last line, first line" which is a bit strange so I
guess they put in the "%r" in the 4.1 termcap so you would pass them in the
order "first line, last line".  However, in ex/vi 3.6 that comes with 4.1BSD
the "cs" string isn't used anywhere, while in ex/vi 3.7 that comes with 4.1c
it is used but "tgoto" is called with the arguments "last line, first line".
Therefore, I'd vote for "last line, first line" being the right arguments to
"tgoto" when used with the "cs" string, and leaving the "%r" out.

	Guy Harris
	{seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy

mark@cbosgd.UUCP (Mark Horton) (09/26/83)

The vt100 cs string should NOT have a %r in it.  The two arguments to
tgoto have always been backwards from what you would expect.  This
is especially noticable when you only pass one parameter (e.g. to
one of the parameterized local motion capabilities) since you must
call tgoto(UP, 0, nlines) instead of the expected tgoto(UP, nlines).
This also makes it impossible to have more than 2 parameters passed
through tgoto - the code just alternates between the two parms passed.

This was fixed in terminfo by replacing tgoto with tparm, which
accepts up to 9 parameters:
	tparm(parm_up_cursor, nlines)

	Mark Horton