Re: elf: openpty () usage question
On Mon, May 28, 2001 at 10:42:45PM -0700, elf@florence.buici.com wrote:
> I've been working on which should be a straightforward stream
> redirector. Open a tty device on a local machine. Everything written
> to the tty is passed over the network to another host. Everything
> written by that remote host on a similar device is sent back to the
> local tty over the network.
>
> I've looked at the xterm code where it calls openpty and I've found
> someone's source online that is supposed to do this. The xterm code
> doesn't shed much light and the rtty sample doesn't appear to work
> (nor does it use openpty).
>
> The question is this. What does openpty return? Do the master and
> slave make a two-way pipe such that what is written to master can be
> read on slave and vice versa? If not, what exactly is the
> relationship between them?
That's how it works alright. I tend to just call it as
ret = openpty(&master_fd, &slave_fd, NULL, NULL, NULL)
because I rarely need the other bits: name, termios etc but they can be useful.
patrick
Reply to: