Subject: Re: Detecting keyboard press
To: Bruce Martin , <netbsd-help@netbsd.org>
From: Richard Rauch <rauch@rice.edu>
List: netbsd-help
Date: 12/04/2001 07:03:09
Detecting a key press depends on the context.

Are you at a text console (either without running X, or running in an
xterm---over even over a ssh link)?  Or do you want to set up your own X
window?  Or are you using GLUT with the OpenGL?  Or some other toolkit?

In a windowing situation, this tends to be easier, since you get varous
event messages (or callbacks).  In a text-based application, one way to do
it is to put the tty into ``raw'' mode, and spin off a seperate process to
wait on input while the other process starts your endless ``determine the
meaning of life loop''.  When input comes to the first process, it can
then signal the looping process, and both can exit.

That's not a terribly elegant solution, but it should work.  (^&


  ``I probably don't know what I'm talking about.'' --rauch@math.rice.edu