home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / shell / 3902 < prev    next >
Encoding:
Text File  |  1992-09-11  |  2.2 KB  |  59 lines

  1. Newsgroups: comp.unix.shell
  2. 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
  3. From: subbarao@tex.Princeton.EDU (Kartik Subbarao)
  4. Subject: Re: Simulating keyboard input in interactive programs
  5. Message-ID: <1992Sep11.142202.11116@Princeton.EDU>
  6. Sender: news@Princeton.EDU (USENET News System)
  7. Nntp-Posting-Host: tex.princeton.edu
  8. Reply-To: subbarao@fc.hp.com (Kartik Subbarao)
  9. Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');
  10. References: <1992Sep9.045525.2667@ads.com> <1992Sep10.163557.10186@siesoft.co.uk> <joslin.716216242@c0223.ae.ge.com>
  11. Date: Fri, 11 Sep 1992 14:22:02 GMT
  12. Lines: 45
  13.  
  14. In article <joslin.716216242@c0223.ae.ge.com> joslin_paul@ae.ge.com writes:
  15. >>pdel@ADS.COM (Peter Delevoryas) writes:
  16. >>: #2
  17. >>:     This is kind of related to #1. Our dial-in lines are set to
  18. >>:     auto-log out after about 20 min. of inactivity. Short of
  19. >>:     programming the terminal-server not to do this, how can I
  20. >>:     keep a process going so that it always seems like I'm doing
  21. >>:     something, even if I'm in the kitchen making a BLT (extra mayo).
  22. >>:     Just starting up some kind of loop won't do it; it has to be
  23. >>:     equal to a keypress from MY keyboard.
  24. >
  25. >Two quick thoughts:
  26. >
  27. >If you're using a pc at home, what about a TSR that puts a "space-CR"
  28. >in the keyboard buffer every five minutes?
  29.  
  30. This would be a good solution, but you'd also want to put some checking
  31. that the user was *idle* for five minutes. I can imagine it now:
  32.  
  33. % rm -rf * [hmm, do I want to do this?]
  34. % [ OH NO, my TSR hit return for me!!! ] 
  35.  
  36. >Second, have you tried something like
  37. >
  38. >while :
  39. >do
  40. >    sleep 3600
  41. >    echo "ls" > `tty`
  42. >done
  43. >
  44. >where `tty` returns the tty device your shell is using.
  45.  
  46. I quote again from the very article you replied to:
  47.  
  48. >>: Just starting up some kind of loop won't do it; it has to be
  49. >>: equal to a keypress from MY keyboard.
  50.  
  51. Redirecting the output of echo to your tty simply writes the text 'ls' on
  52. your terminal. Just as if you said "echo thousandlineslong" > `tty`. It
  53. does NOT write to the input buffer of the tty. To do so, you can use the 
  54. TIOCSTI ioctl if you have it.
  55.  
  56. Once again, please test your solutions before you post them.
  57.  
  58.     -Kartik
  59.