[comp.unix.xenix] Pty driver info needed.

larry@tapa.UUCP (Larry Pajakowski) (02/11/89)

Chip's message about script reminds me that I have been unable to get any info
on the pty driver in the SCO 386 kernel.  I've asked SCO support twice for
information and get more or less "sorry that's not supported".  Ok I
understand that but I still have a good application for them.  How close are
they to the Berkeley or Sun pty drivers?  Can anyone enlighten me and the rest
of this group on their findings. 

Any help will be appreciated.  Thank's.

Larry Pajakowski

ag@elgar.UUCP (Keith Gabryelski) (02/15/89)

In article <603@tapa.UUCP> larry@tapa.UUCP (Larry Pajakowski) writes:
>Chip's message about script reminds me that I have been unable to get
>any info on the pty driver in the SCO 386 kernel.

>How close are they to the Berkeley or Sun pty drivers?

They seem pretty close.  But I noticed a possible name clash with
mscreen(M) and standard ptys.

ptys in mscreen(M) seemed to named (slave) `/dev/ttyp%d' and (master)
`/dev/ptyp%d' where `%d' is the some number.

This is not compatible with other ptys which are named (slave)
`/dev/tty%c%x' and (master) `/dev/pty%c%x' where `%c' is a letter `p'
and up and `%x' is a hex digit.

The following code fragment from my version of BSD script(1/C) may
explain what I mean a little better.

This code tries to find an available pty on the system.

	*--------------------------------------*
    found_pty = FALSE;
 
    for (i=0; i < 255 && !found_pty; ++i)
    {
#ifdef SCO_PTYS
	(void) sprintf(master_pty_filename, "/dev/ptyp%d", i);
#else /* !SCO_PTYS aka The Real Thing */
	(void) sprintf(master_pty_filename, "/dev/pty%c%x", 'p'+i/16, i%16);
#endif /* !SCO_PTYS */

	if ((master_pty_fd = open(master_pty_filename, O_RDWR)) != -1)
	{
#ifdef SCO_PTYS
 	    (void) sprintf(slave_pty_filename, "/dev/ttyp%d", i);
#else /* !SCO_PTYS aka The Real Thing */
 	    (void) sprintf(slave_pty_filename, "/dev/tty%c%x", 'p'+i/16,
			   i%16);
#endif /* !SCO_PTYS */

	    if ((slave_pty_fd = open(slave_pty_filename, O_RDWR)) < 0)
	    {
		(void)
		    fprintf(stderr,
			    "%s: Couldn't open slave pseudo tty: %s (%s).\n",
			       progname, slave_pty_filename,
			       long_error(errno));
		(void) exit(1);
	    }
 	    else
 		found_pty = TRUE;
	}
    }
	*--------------------------------------*

So, in your code you must compensate for either naming conventions.
Possibly by using one of the above naming conventions (modifing
existing code that may need it; ie GNU EMACS) or by using bother
naming conventions.

>Can anyone enlighten me and the rest of this group on their findings.

^S and ^Q will not pass through the SCO ptys unless you `stty -ixon
-ixoff' before doing the mscreen(M) thing.  I do the ioctl thing in
script(C) to solve this problem.

Remember to open both sides of the pty to make sure it is availble for
use since the slave could have a getty running on it (for use in
mscreen(M)).

Pax, Keith
-- 
ag@elgar.CTS.COM         Keith Gabryelski          ...!{ucsd, crash}!elgar!ag