Problems with pty under Cygwin
Andrej Borsenkow
Andrej.Borsenkow@mow.siemens.ru
Fri Jul 7 02:40:00 GMT 2000
A program opens pty and starts external command attached to the slave
side. Parent reads from master side a character at a time in
non-blocking mode. The problem is, parent gets EOF (read() returns zero)
after every line of child output.
The pty is opened with:
static int
get_pty(int master, int *retfd)
{
static char *name;
static int mfd, sfd;
int ret;
if (master) {
if ((mfd = open("/dev/ptmx", O_RDWR)) < 0)
return 1;
if (grantpt(mfd) || unlockpt(mfd) || !(name = ptsname(mfd))) {
close(mfd);
return 1;
}
*retfd = mfd;
return 0;
}
if ((sfd = open(name, O_RDWR)) < 0) {
close(mfd);
return 1;
}
*retfd = sfd;
return 0;
}
It is based on API list that mentions grantpt() & Co.
What do I do wrong? The same program runs fine on Unix returning full
child output.
-andrej
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
More information about the Cygwin
mailing list