[comp.sources.bugs] termcap.c for nethack

xsimon@its63b.ed.ac.uk (Simon Brown) (08/09/87)

In article <144@auscso.UUCP> knutson6@auscso.UUCP (John Knutson) writes:
>I was looking through termcap.c to see if I could figure out what all the
>garbage was when something was thrown, and I came up with this:
>	if(!flags.nonull)
>		tputs("50", 1, xputc);
>
>		/* cbosgd!cbcephus!pds for SYS V R2 */
>		/* is this terminfo, or what? */
>		/* tputs("$<50>", 1, xputc); */
>Looking in the man page for term, it says that the $<50> is padding
>information.  But, it still comes out with $<1> on the vt100 doing an
>inventory.  Could this be because you MUST have two digits?
>Inquiring minds want to know....

No, this is because of the gross way that highlighting is done for the
inventory - it does a (approximately)
	sprintf(str, "%s%s%s", HI, message, HE)
(where HI, HE are the highlight-start, highlight-end strings), and
then prints it out directly - doesn't use tputs! No wonder the $<number>
happens if you have an output-delay for highlighting (as the vt100 does)!
This must happen even using termcaps.

I've fixed it here, but in a really gross way - so I won't post it.

-- 
----------------------------------
| Simon Brown                    | UUCP:  seismo!mcvax!ukc!its63b!simon
| Department of Computer Science | JANET: simon@uk.ac.ed.its63b
| University of Edinburgh,       | ARPA:  simon%its63b.ed.ac.uk@cs.ucl.ac.uk
| Scotland, UK.                  |
----------------------------------     "Life's like that, you know"