Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!sdd.hp.com!uakari.primate.wisc.edu!bin From: bin@primate.wisc.edu (Brain in Neutral) Newsgroups: comp.unix.programmer Subject: Distinquishing escape key from arrow and function keys Message-ID: <4193@uakari.primate.wisc.edu> Date: 10 Apr 91 17:44:24 GMT Organization: Cafe Limbo Lines: 23 I have a program where the escape key is significant, but I also want to be able to use the arrow and functions keys (which typically also begin with escape). I would be interested in how any of you solve this problem. My solution (if you can call it that): when an escape character is seen, keep reading until (i) characters read entirely match some special key. return some value (I use values >= 0200) to indicate such. (ii) characters read fail to match any special key character sequence. return escape to caller and save any other characters read to a pushback queue. (iii) timeout after brief wait and neither (i) nor (ii) obtain. return escape to caller and save any other characters read to a pushback queue. 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? -- Paul DuBois "The 'C' shell usually doesn't dubois@primate.wisc.edu have job control." -- LAN TIMES