termcap question

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Thu Feb 24 17:43:05 UTC 2005


On Mon, Feb 21, 2005 at 01:20:06PM -0500, Madison Kelly wrote:
> Hi all,
> 
>   I have installed a (commercial) accounting package at a clients and 
> everything went well except one issue. The arrow keys aren't working 
> properly. Speaking to their tech-support (OSAS is the company) they had 
> me run a little program inside their app that reported keystroke codes 
> (I am guessing). The guy told me to edit my '/etc/termcap' file to 
> create a new console ('linux' and 'xterm' didn't work) that "used those 
> codes (see below) for the arrow keys.".
> 
>   Unfortunatly he was unwilling to give me any forther guidance because 
> it was outside their program. I need to make it so that when the arrow 
> keys these codes are passed:
> 
> up-arrow...: \E0A
> down-arrow.: \E0B
> left-arrow.: \E0D
> right-arrow: \E0C
> 
>   I am feeling honestly lost. I can understand the logic (change the 
> code passed to the program when key X is pressed) but beyond that I 
> don't have a clue what to do. The file itself is... cryptic... and the 
> pointer for more help in it is no longer valid.
> 
>   If anyone can give me a pointer or two I would (again) be greatul!

Well my cursor keys send \E[A, \E[B, \E[C and \E[D, I wonder if some
idiot programmer hardcoded some broken terminal's codes rather than
read values from the current termcap/terminfo environment like any sane
programmer would.  That's why the @#$@#$ information is in the env in
the first place.

I checked ansi, xterm, vt100, 102, 220, pcansi, cons, and many more.
They ALL use \E[A not \E0A.  I wonder if MS telnet uses the wrong codes
(it seems to get codes wrong for just about everything else a telnet
client should do).

Besdies most linux distributions use terminfo/termcap to tell apps what
something sends, they don't use it to _control_ what something sends.
You woul have to rewrite the terminal to do that (one would hope so,
since you would have to be able to assume that an xterm sends the same
codes no matter who wrote it, so everyone should have identical
terminfo.termcap files for xterm to tell their programs what to expect
when run by a user on an xterm.

termcap is no longer in use on Linux (and most other unix systems for
that matter), since it has problems, and terminfo works better and fixed
all the problems.  Editing /etc/termcap will do NOTHING (unless their
program is soo old it actualyl tries to use /etc/termcap).  If their
program does use /etc/termcap or the TERMCAP env, you should be able to
set that to the right values and their pgoram should look for the right
values, but most likely they just hardcoded what they saw for cursor
keys in whatever client they tried first (which was probably one of the
broken ones).

Lennart Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list