🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3599

Question on terminal escape key sequences

#3599
From: Neal Mazer
Date: Tue, 01 Aug 1995 18:44
22 lines
1082 bytes
Hello,

I need to parse keystrokes that include the escape key or an escape
sequence that may be 3 or 4 chars long.

I can see two options for doing this:

1.  after read() check to see if the char value == 27 and if so then
    read in each subsequent character in the escape sequence if there
    is one.  To do this I need to be able to check for a character
    waiting.

2.  set up a read that does not block. I use the STDIN_FILENO file
    descriptor which is available without use of open().  Therefore I 
    don't have the option of setting the O_NDELAY flag.  Or should I
    open the standard input?

This isn't a new problem so I thought I'd check here to see what the
recommended practice is.

Thanks in advance,
Neal
Technical Details
Message-ID: <3vlsls$dv0@lynx.unm.edu>
Path: arc1-ca.pugleaf.net!lynx.unm.edu!news

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!lynx.unm.edu!news
From: mazer@technet.nm.org (Neal Mazer)
Newsgroups: comp.std.c
Subject: Question on terminal escape key sequences
Date: 1 Aug 1995 18:44:12 GMT
Organization: New Mexico Technet
Message-ID: <3vlsls$dv0@lynx.unm.edu>
NNTP-Posting-Host: mazer.nm.org
Mime-Version: 1.0
X-Newsreader: WinVN 0.99.3