HOw do you monitor keyboard and mouse input?

Michael A. Petonic mikep at ism780c.isc.com
Sat Aug 27 05:23:00 AEST 1988


In article <2181 at ssc-vax.UUCP> dmg at ssc-vax.UUCP (David Geary) writes:
 >  I've got a question to which I'm hoping that there is 
 >a pretty simple answer.  I need to write a program which 
 >will sit in the background and watch the keyboard and
 >mouse for input.  Of course, I don't want to "disturb"
 >the input, just "sit" in the food chain and observe.
 >Do I need to write a daemon?  Help.  I have to get
 >this done three weeks ago.  Thanks ;-)

Well, if you are using a system with PTY's, you can write a program
that opens both devices, fork another process (to actually read
and disturb the input :-), and dup the file descriptors comming off
of the PTY to whatever the new process will expect, and then
exec the new program.

Then, in your parent process (the one that originally opened the
PTY), you could sit in a loop, getting input from the mouse
and keyboard and passing the data along the apropriate PTY.

-MikeP
-- 
Michael A. Petonic				mikep at ism780c.isc.com

       ``Living in the pools, they soon forget about the sea.''



More information about the Comp.unix.questions mailing list