How to open & use ptys

How to open & use ptys

Post by Sererbok Reticuy » Sat, 26 Nov 1994 05:30:04



I'm looking for a way (preferrably other than using /dev/ptmx with
/dev/styxx) to use virtual terminals, similarly to how rlogin uses
them.  The source code to rlogind from BSD386 won't compile, and
the virtual terminal manager screen.tar.Z is hopelessly convoluted.
Does anyone have any idea how to use the master/slave setup with
/dev/ttyXY and /dev/ptyXY?
SysVR4 has a very simple suite of function calls to use virtual
terminals:
        fd=open ("/dev/ptmx",O_RDWR)
        grantpt(fd);
        unlockpt(fd);
        slavename=ptsname(fdm);
        slavefd=open(slavename,O_RDWR);

And voila! fd is the master File descriptor for the server application
and slavefd is stdin, stdout, and stderr of the newly spawned
application.
If I just open /dev/ptyXY as the slave, and /dev/ttyXY as the master
under SCO, output to /dev/ttyXY shows up as input from /dev/ptyXY,
but output to /dev/ptyXY goes nowhere.  What gives?
Anyone have any clues?

 
 
 

1. Using read() & open()

Hi, I'm trying to use open and read to open a file and read it's
contents.  The file will contain a bunch of characters.  All I want to
do is open it, read all the characters and find out how many bytes
there were in the file, actually seeing the characters isn't important
to me.  But I can't get it to work, I'll show you what I did.

char buffer[buff_size];
int n, val = 1;

n = open( "filename.dat", val);
read( n, &buffer, sizeof( char) );

ok, this is a stripped down version, and I've tried it several ways,
but no luck.  as for open, I'm not to sure what exactly to put for the
flag, the man command in unix game me a bunch of words, but I just
kept getting back that they weren't recognized when I compiled the
program.
Thanks for any help, and yes, I am pretty new to C.

Ford

2. The mousepointer does not change...

3. Open Server 5 - using SCSI & IDE

4. EXAR 17C158

5. opening ptys - intermitant problem

6. pppd error - tcgetattr: Input/output error(5)

7. opening /dev/pty*

8. 3com 905xl

9. Help : subshell.c : couldn't open master side of pty

10. problem opening xterm shell -- no available ptys

11. How do I open a pty/tty pair?

12. Should read of pty block when no one has opened tty?

13. telnetd fails opening pty, "all network ports in use