[comp.unix.questions] Getting arrow key sequences from termcap.

EACONS@MTUS5.BITNET (Ernie Anderson) (02/12/90)

Hello all,
     I am in the process of writing a large class program, and I noticed an
occurance that confused me.  The program is very visually oriented, so it needs
to use cursor movement, hightlighting, etc.  I couldn't find out how to get the
values for the arrow keys out of curses, and I was in a hurry to get other
things done, so I just hardcoded the values for the terminals in the lab into
it.  Thing is, when I tried to work on it from home, it didn't work.  My term
emulator prog at home was sending ESC O A-D and the ones in the lab sent ESC
[ A-D.  I just worked on it in the lab.  Finally I went to do it right so that
it would work at all locations, and I'm stuck.  The lab terminals (Esprit brand
) are emulating vt100's.  Thing is they have two cursor modes 'application' and
'normal'.  The termcap they use for the vt100's says the second character of
the key sequence should be 'O', but the terminals are normally in the mode with
the '[', and everything works fine.  Matter of fact, if you swap the cursor
modes, vi won't accept the cursor keys.  It does at home, and I specify the
same termcap.
     So basically I'm lost.  I managed to get what I did out of termcap after
about 2 hours work, and I'm not about to plunge back in with no direction. I
need to have a way to find out what the currently specified terminal is going
to send for the cursor keys after the program is run.  I don't care how.  I
don't care if no one tries to explain the above weird( to me )ness.  I just
want to be able to test my program at home and at the lab, and at the suns
at work.  Please email me if possible, I don't usually read this group for time
reasons.  If all your mail bounces, go ahead and post, because if I don't get
any responses personally, I'll make the time to read.

Ernie Anderson
EJANDERS@MTUS5.BITNET
EACONS@MTUS5.BITNET