home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / linux / 6848 < prev    next >
Encoding:
Internet Message Format  |  1992-07-28  |  1014 b 

  1. Path: sparky!uunet!usc!rpi!bu.edu!dartvax!coos.dartmouth.edu!platt
  2. From: platt@coos.dartmouth.edu (The Crouton Man)
  3. Newsgroups: comp.os.linux
  4. Subject: bug in /dev/tty
  5. Message-ID: <1992Jul28.060505.29450@dartvax.dartmouth.edu>
  6. Date: 28 Jul 92 06:05:05 GMT
  7. Sender: platt@coos.dartmouth.edu
  8. Organization: Dartmouth College, Hanover, NH
  9. Lines: 27
  10.  
  11. ok, i am using 0.96cpl2 + autodetect + filefs.
  12. shell: rc ( and bash for test )
  13.  
  14. it is my understanding that you should be able to open /dev/tty
  15. in order to capture keyboard input even if the stdin is redirected 
  16. from a file or pipe. however, when i do the following:
  17.  
  18. cat foo | myprogram 
  19.  
  20. and 
  21.  
  22.     fd = open("/dev/tty",O_RDONLY); 
  23.     printf("fd: %d\n",fd);
  24.  
  25. i get 
  26.  
  27.     fd: 0
  28.     
  29. which should be stdin, and it is, but not the keyboard (tty).
  30. should not i have a separate file descriptor from the stdin? 
  31. more importantly why don't i, and how do i open the keyboard (tty),
  32. as opposed to stdin (which has been redirected from stdin).
  33.  
  34. any ideas? 
  35.  
  36. croutons
  37. croutons@dartmouth.edu
  38.