TERMCAP PUZZLE

aura berquist aura at uwmacc.UUCP
Tue Apr 29 07:56:47 AEST 1986


We are running 2.8 BSD UN*X on an 11/70 but we're using the
2.9 BSD UN*X version of lpr from our distribution tape.

In printcap.c there is a routine called tgetent which when
called from lpr,lpd, and a filter for our pen plotter is
supposed to get the printcap entry for the printer specified.
This information is put into a buffer called bp which is
1024 bytes long.  While inserting this information into bp
the program checks the address of the pointer moving across
bp to ensure that it is within bounds of bp's size.

The puzzle is that with different terminal types (i.e. varying
termcap entries  - NOT printcap) the result of this check 
varies.  A termtype of z29 with a termcap entry 4 lines long
starts bp at address 175614 and successfully completes the 
check as does a termtype of vt100 with a termcap entry 6 lines
long starting bp at 175340.  However, a termtype of vt52
with a termcap entry 1.5 lines long starts bp at 176124 and
does not pass the check since bp + 1024 results in a wrap
around.

Why does the initial address of bp vary inversely with the
size of the termcap entry?

		bp			lines per termcap entry
	   ______________________________________
	   |   		 |							|
vt52   | 176124  |		1.5					|
       |         |							|
z29	   | 175614  |		4					|
	   |		 |							|
vt100  | 175340  |		6					|
	   |_____________________________________    


Thanks.


-- 
	Aura Leigh Berquist ...!uwvax!uwmacc!aura or ...!uwmacc!sal70!aura



More information about the Comp.unix mailing list