[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: elf: openpty () usage question



Hmm.  Well then my code must be awfully mungified.  When I write to
the slave device (/dev/pts/?), the master reads the data.  When I
write the master device...the master reads the data.  Oddly, this
appears to be the same behavior exhibited by the rtty program I found
on the net.

Do you a sample you're willing to share?

On Tue, May 29, 2001 at 02:29:42PM +0100, Patrick Caulfield wrote:
> 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
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: