Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Sat, 30 Dec 2000 23:19:17 +0200 Message-Id: <200012302119.XAA26674@linux.> From: "Ehud Karni" To: cygwin AT cygwin DOT com Subject: How to create tty/pty pair ? Organization: Simon & Wiesel Insurance agency Reply-to: ehud AT unix DOT simonwiesel DOT co DOT il X-Mailer: Emacs 20.7.1 rmail (send-msg 1.104) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-8 Content-Transfer-Encoding: 7bit I do not know how to make a tty/pty pair with Cygwin. I went over the faq and the ncursus readme and did not find an answer or a pointer to an answer to this question. Can the Cygwin gurus help me on this ? The only reference I found (in the faq is this: Sergey Okhapkin (sos AT prospect DOT com DOT ru) has been an invaluable Net contributor. He implemented the tty/pty support, has played a significant role in revamping signal and exception handling, and has made countless contributions throughout the library. He also provided binaries of the development snapshots to the Net after the beta 19 release. So I have the notion that tty/pty is supported on Cygwin. Here is the code I use on Linux (and some other UNIX systems): int allocate_pty () { struct stat stb ; int fd , i ; for ( i = 1 ; i < 256 ; i++ ) { sprintf (pty_name, "/dev/ptyp%d", i ) ; if ( stat ( pty_name , & stb ) < 0 ) return -1; fd = open (pty_name, O_RDWR | O_NONBLOCK, 0); if ( fd >= 0 ) { pty_name [5] = 't' ; /* change /dev/pty?? to /dev/tty?? */ if ( access ( pty_name, W_OK | R_OK ) != 0 ) { close (fd); continue ; } return fd; } } return -1 ; } Ehud. -- @@@@@@ @@@ @@@@@@ @ @ Ehud Karni Simon & Wiesel Insurance agency @ @ @ @@ @ Tel: +972-3-6212-757 Fax: +972-3-6292-544 @ @ @ @ @ @@ (USA) Fax and voice mail: 1-815-5509341 @ @ @ @ @ @ Better Safe Than Sorry http://www.simonwiesel.co.il mailto:ehud AT unix DOT simonwiesel DOT co DOT il -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple