home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!princeton!tex.Princeton.EDU!subbarao
- From: subbarao@tex.Princeton.EDU (Kartik Subbarao)
- Subject: Re: Simulating keyboard input in interactive programs
- Message-ID: <1992Sep11.142202.11116@Princeton.EDU>
- Sender: news@Princeton.EDU (USENET News System)
- Nntp-Posting-Host: tex.princeton.edu
- Reply-To: subbarao@fc.hp.com (Kartik Subbarao)
- Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');
- References: <1992Sep9.045525.2667@ads.com> <1992Sep10.163557.10186@siesoft.co.uk> <joslin.716216242@c0223.ae.ge.com>
- Date: Fri, 11 Sep 1992 14:22:02 GMT
- Lines: 45
-
- In article <joslin.716216242@c0223.ae.ge.com> joslin_paul@ae.ge.com writes:
- >>pdel@ADS.COM (Peter Delevoryas) writes:
- >>: #2
- >>: This is kind of related to #1. Our dial-in lines are set to
- >>: auto-log out after about 20 min. of inactivity. Short of
- >>: programming the terminal-server not to do this, how can I
- >>: keep a process going so that it always seems like I'm doing
- >>: something, even if I'm in the kitchen making a BLT (extra mayo).
- >>: Just starting up some kind of loop won't do it; it has to be
- >>: equal to a keypress from MY keyboard.
- >
- >Two quick thoughts:
- >
- >If you're using a pc at home, what about a TSR that puts a "space-CR"
- >in the keyboard buffer every five minutes?
-
- This would be a good solution, but you'd also want to put some checking
- that the user was *idle* for five minutes. I can imagine it now:
-
- % rm -rf * [hmm, do I want to do this?]
- % [ OH NO, my TSR hit return for me!!! ]
-
- >Second, have you tried something like
- >
- >while :
- >do
- > sleep 3600
- > echo "ls" > `tty`
- >done
- >
- >where `tty` returns the tty device your shell is using.
-
- I quote again from the very article you replied to:
-
- >>: Just starting up some kind of loop won't do it; it has to be
- >>: equal to a keypress from MY keyboard.
-
- Redirecting the output of echo to your tty simply writes the text 'ls' on
- your terminal. Just as if you said "echo thousandlineslong" > `tty`. It
- does NOT write to the input buffer of the tty. To do so, you can use the
- TIOCSTI ioctl if you have it.
-
- Once again, please test your solutions before you post them.
-
- -Kartik
-