home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.osf.osf1
- Path: sparky!uunet!think.com!paperboy.osf.org!rsalz
- From: rsalz@osf.org (Rich Salz)
- Subject: Re: /dev/ptm
- Message-ID: <1992Dec22.190242.17498@osf.org>
- Keywords: terminals
- Sender: news@osf.org (USENET News System)
- Organization: Open Software Foundation
- References: <1992Dec22.091437.11429@dcs.warwick.ac.uk>
- Date: Tue, 22 Dec 1992 19:02:42 GMT
- Lines: 22
-
- In <1992Dec22.091437.11429@dcs.warwick.ac.uk> rince@dcs.warwick.ac.uk (James Bonfield) writes:
- >Hello,
- > Why does the 'script' command allocate itself a new controlling tty
- >and yet no other 'standard' (eg emacs, fep) program seem able to?
- Look at pty_master(3) and pty_slave(3). You want to do something like
- this, I believe:
- int m, s;
- struct winsize win;
- struct termios tt;
-
- m = pty_master();
- tcgetattr(0, &tt);
- ioctl(0, TIOCGWINSZ, &win);
- if (fork == 0) {
- s = pty_slave(m);
- tcsetattr(s, TCSANOW, &win);
- ioctl(s, TIOCSWINSZ, &win);
- setsid();
- ioctl(s, TIOCSTTY, 0);
- }
- There is a nice section on controlling terminals in tty(7).
- /r$
-