[comp.os.minix] stevie with -DTERMCAP

laverman@prismab.prl.philips.nl (Bert Laverman) (02/01/89)

(minix/ST problem, PC as well???)

  I am having a problem with stevie when compiled with -DTERMCAP.
The distributed version is hardwired for the minix terminal, but
code is present for using the termcap facility. When compiling
with -DTERMCAP, (have to add term.c to makefile) I do not seem
to be able to get stevie running.
  In minix mode, the program checks for the presence of the TERM
variable, and complains if it isn't minix. This is a hardwired
complaint, and does not depend on any entries in /etc/termcap.
In termcap mode, with TERM=vt100; export TERM, I always get a
``invalid terminal type'' type of message. Looking at the code
this can only happen if tgetent() and the lot don't work.
Testing with termcap(1) I found that some bugfixes were needed
that were incorporated in the GNU-gcc library. Now termcap(1)
work correctly for ANY terminal available in /etc/termcap,
both when compiled with ACK cc and mgcc.
  Stevie itself won't be compiled with mgcc, as `normal.c' is
to large for a 1M ST. I'll try splitting her up some day soon.

So:
	Compile stevie with -DTERMCAP  (add term.c in makefile)
	TERM=someterminalname; export TERM
	run stevie
  will get (me) an error message from stevie.

  tgetent(3) and relatives seem to work when tested with
termcap(1).
  Maybe related is the problem I have with `sokoban'. It will
compile fine with mgcc, (curses is needed) but it does
`sweet nothing'.

--Can somebody help me out?!? I want to use the second tty!

Bert Laverman.

rtregn@immd3.informatik.uni-erlangen.de (Robert Regn) (02/02/89)

From article <384@prles2.UUCP>, by laverman@prismab.prl.philips.nl (Bert Laverman):
 
> (minix/ST problem, PC as well???)
I speak ONLY for the PC - but this should make no difference

 
>   I am having a problem with stevie when compiled with -DTERMCAP.
> The distributed version is hardwired for the minix terminal, but
> code is present for using the termcap facility. When compiling
> with -DTERMCAP, (have to add term.c to makefile) I do not seem
> to be able to get stevie running.
>   In minix mode, the program checks for the presence of the TERM
> variable, and complains if it isn't minix. This is a hardwired
> complaint, and does not depend on any entries in /etc/termcap.
YES
> In termcap mode, with TERM=vt100; export TERM, I always get a
> ``invalid terminal type'' type of message. Looking at the code
> this can only happen if tgetent() and the lot don't work.

With DTERMCAP there is no  "Invalid terminal type '%s'\n" message
but a "unknown terminal type\n" message. It stands for a lot of problems
with the termcap file e.g. if mandatory entries are missing. (see term.c)
I have tested vi_with_termcap on a PC and this termcap file
(I'm working on a sun with the tty1):

su|sun|sunworkstation:\
	bs:\
	cd=\E[0J:\
	cl=\E[H\E[0J:\
	cm=\E[%i%d;%dH:\
	co#80:\
	ho=\E[H:\
	li#40:\
	se=\E[0m:\
	so=\E[7m:\
	sr=\EM:\
	ce=\E[K:\
	al=\E[L:dl=\E[M:\
	sc=\E7:rc=\E8:\
	up=\E[A:nd=\E[C

mx|minix|ansi:\
	bs:\
	cd=\E[0J:\
	cl=\E[H\E[0J:\
	cm=\E[%i%d;%dH:\
	co#80:\
	ho=\E[H:\
	li#25:\
	se=\E[0m:\
	so=\E[7m:\
	sr=\EM:\
	ce=\E[K:\
	al=\E[L:dl=\E[M:\
	sc=\E7:rc=\E8:\
	up=\E[A:nd=\E[C

Look at the syntax of the first line - the sun (or vt100) must be in the second
position. Here is what the sun manual entry termcap(5) says:

TERMCAP(5)                FILE FORMATS                 TERMCAP(5)

     Each termcap entry consist of a  number  of  colon-separated
     (:)  fields.   The  first  field for each terminal lists the
     various names by which it is known, separated by bar (  |  )
     characters.   The  first name is always two characters long,
     and is used by older (version 6) systems  (which  store  the
     terminal  type  in a 16-bit word in a system-wide database).
>    The second name given is the most  common  abbreviation  for
     the terminal (this is the one to which the environment vari-
     able TERM would normally be  set).   The  last  name  should
     fully  identify  the  terminal's  make and model.  All other
     names are taken as synonyms for the initial  terminal  name.
     All names but the first and last should be in lower case and
     contain no blanks; the last name may well contain upper case
     and blanks for added readability.

> So:
> 	Compile stevie with -DTERMCAP  (add term.c in makefile)
> 	TERM=someterminalname; export TERM
> 	run stevie
>   will get (me) an error message from stevie.

I got no errors with TERM=sun and above termcap.
If this don't help, insert messages before each return 0 in t_init() (term.c).
I used 1.3c termcap(3) with corrections efth      1988-Apr-29


Robert Regn
rtregn@faui32.uucp
rtregn@immd3.informatik.uni-erlangen.de

laverman@prismab.prl.philips.nl (Bert Laverman) (02/08/89)

  I found the problem I mentioned earlyer. It appeared that /etc/termcap
was grossly incomplete... according to stevie that is.
The missing entries were:
	al : add line
	dl : delete line
	sc : cursor state save
	rc : cursor state restore
For the vt100 (don't ask me what version. vt102 maybe) the entries are:
	:al=\E[L:dl=\E[M:\
	:sc=\E7:rc=\E8:

Since they weren't in /etc/termcap, I suppose the minix terminal doesn't
know them. (BTW indeed, TERM=minix gave problems as well)

My home-brew terminal emulator didn't know them either, so it'll
give me some work. But I always liked Z80 hacking anyway.

Thanks for all reactions. If anybody manages to get sokoban
(was posted some time ago in comp.sources.games) up and running,
please mail me! Mine compiles fine, but it simply refuses to work.

Bert Laverman