home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / osf / osf1 / 39 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.0 KB  |  35 lines

  1. Newsgroups: comp.unix.osf.osf1
  2. Path: sparky!uunet!think.com!paperboy.osf.org!rsalz
  3. From: rsalz@osf.org (Rich Salz)
  4. Subject: Re: /dev/ptm
  5. Message-ID: <1992Dec22.190242.17498@osf.org>
  6. Keywords: terminals
  7. Sender: news@osf.org (USENET News System)
  8. Organization: Open Software Foundation
  9. References: <1992Dec22.091437.11429@dcs.warwick.ac.uk>
  10. Date: Tue, 22 Dec 1992 19:02:42 GMT
  11. Lines: 22
  12.  
  13. In <1992Dec22.091437.11429@dcs.warwick.ac.uk> rince@dcs.warwick.ac.uk (James Bonfield) writes:
  14. >Hello,
  15. >    Why does the 'script' command allocate itself a new controlling tty
  16. >and yet no other 'standard' (eg emacs, fep) program seem able to?
  17. Look at pty_master(3) and pty_slave(3).  You want to do something like
  18. this, I believe:
  19.      int m, s;
  20.      struct winsize win;
  21.      struct termios tt;
  22.  
  23.      m = pty_master();
  24.      tcgetattr(0, &tt);
  25.      ioctl(0, TIOCGWINSZ, &win);
  26.      if (fork == 0) {
  27.          s = pty_slave(m);
  28.          tcsetattr(s, TCSANOW, &win);
  29.          ioctl(s, TIOCSWINSZ, &win);
  30.          setsid();
  31.          ioctl(s, TIOCSTTY, 0);
  32.     }
  33. There is a nice section on controlling terminals in tty(7).
  34.     /r$
  35.