Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: u98saino AT eniac DOT sci DOT kagoshima-u DOT ac DOT jp (Hiroshi Sainohira) To: cygwin AT cygwin DOT com Subject: flushinp on /dev/ptmx Date: Mon, 15 Sep 2003 23:39:16 JST Message-ID: <030915233916.M0129843@edsac.sci.kagoshima-u.ac.jp> Hi, there. I am making a program which uses Ncurses and flushinp. But I have a problem about flushinp. Though this routine worked very fine when I executed the program on the cygwin's default window, it didn't on rxvt or cygterm. To clear this problem, I tested a short code as follows: #include #include #include #include #include #include main() { int master, slave; char buf[256]; /* Open pseudo terminal */ if ((master = open("/dev/ptmx", O_RDWR)) < 0) { return -1; } if (fork() > 0) { /* store buffers.*/ write(master, "123456789\n", 10); sleep(4); exit(0); } else { if ((slave = open(ptsname(master), O_RDWR)) < 0) { exit(0); } close(master); sleep(2); tcflush(slave, TCIFLUSH); /* flushinp */ /* Check whether input buffers are thrown away.*/ memset(buf, 0, sizeof(buf)); read(slave, buf, 10); printf("%s", buf); exit(0); } } When I ran this code on Solaris8 or Linux, the child process threw away "123456789\n". But when on cygwin window, the string keeped on and was printed by child process. Does the pseudo terminal of cygwin( /dev/ptmx ) support flushing input buffer? Cygwin's Version is the 1.5.4-1. Thank you. Hiroshi Sainohira -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/