Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de)
From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: <cygwin@sourceware.cygnus.com>
Subject: Problems with pty under Cygwin
Date: Fri, 7 Jul 2000 13:39:54 +0400
Message-ID: <000601bfe7f7$4e52f0a0$21c9ca95@mow.siemens.ru>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="koi8-r"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Importance: Normal
In-Reply-To: <200007041321.JAA15692@envy.delorie.com>

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

