Distinquishing escape key from arrow and function keys

Brandon S. Allbery KB8JRR/AA allbery at NCoast.ORG
Sun Apr 14 03:47:56 AEST 1991


As quoted from <4193 at uakari.primate.wisc.edu> by bin at primate.wisc.edu (Brain in Neutral):
+---------------
| On a BSD system, select() does the timeout nicely.  I'm not so familiar
| with System V.  Do you use the MIN and TIME special control character
| values in the termio.c_cc[] array?  What about under POSIX?
+---------------

SVR3 curses will do this for you --- when you call keypad() on a window, it
will return special keys as #define'd values starting at 0400.  It has a
timeout of about a second (this may be tuneable via halfdelay()).

Some programs I use make use of VMIN and VTIME.  My own programs don't do
timeouts, but could fairly easily do them because they use select() anyway.
(On systems that support it, at least.)  My main technique for avoiding ESC
anomalies is to not use bare ESC for anything and to try to map things on to
keys without an ESC prefix... which is difficult on a DEC-compatible terminal.

++Brandon
-- 
Me: Brandon S. Allbery			  Ham: KB8JRR/AA on 2m, 220, 440, 1200
Internet: allbery at NCoast.ORG		(QRT on HF until local problems fixed)
America OnLine: KB8JRR // Delphi: ALLBERY   AMPR: kb8jrr.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery          KB8JRR @ WA8BXN.OH



More information about the Comp.unix.programmer mailing list