Xref: utzoo comp.lang.c:12105 comp.unix.questions:8987 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cs.utexas.edu!sm.unisys.com!ism780c!mikep From: mikep@ism780c.isc.com (Michael A. Petonic) Newsgroups: comp.lang.c,comp.unix.questions Subject: Re: HOw do you monitor keyboard and mouse input? Keywords: keystroke, keynote, keycode,... Message-ID: <14651@ism780c.isc.com> Date: 26 Aug 88 19:23:00 GMT References: <2181@ssc-vax.UUCP> Reply-To: mikep@ism780c.UUCP (Michael A. Petonic) Organization: Interactive Systems Corp., Santa Monica CA Lines: 24 In article <2181@ssc-vax.UUCP> dmg@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@ism780c.isc.com ``Living in the pools, they soon forget about the sea.''