Newsgroups: comp.sys.sequent Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!maverick.ksu.ksu.edu!ux1.cso.uiuc.edu!osiris.cso.uiuc.edu!pjm From: pjm@osiris.cso.uiuc.edu (P.McGuinness) Subject: curses and stdio buffering Message-ID: <1991Apr25.175928.15959@ux1.cso.uiuc.edu> Summary: Going in and out of curses changes stdout buffering - why? Keywords: curses, stdio, sequent Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Date: Thu, 25 Apr 1991 17:59:28 GMT Lines: 45 We (several of us at CERL) are porting code from a pyramid to a sequent, and we have had problems with curses. Apparently, when we switch in and out of curses, the terminal modes are not reset correctly when endwin() is called, as claimed in curses(3x) documentation. More fundamentally, when curses goes through initscr(), .. endwin() and then on to stdio-type output, stdio buffering changes. On the sequent, it drops the _IOLBF flag (apparently going to full buffering). I have included some test code that demonstates the problem, and the output we get. Has anyone else observed these problems? Any ideas as to why this is happening? Is it a sequent bug? Am I missing something here? Inquiring (and debugging) minds want to know. We have had other stdio-type problems, some related to curses, some not. They seem to suggest something to do with stdio buffering is amiss. Patrick McGuinness, working at USA-CERL. pjm@osiris.cso.uiuc.edu ------ #include #include main() { printf(" Starts out fine\n"); fprintf(stderr,"iob[1]._flag %d\n",stdout->_flag); initscr(); /* curses stuff deleted */ endwin(); fprintf(stderr,"iob[1]._flag %d\n",stdout->_flag); printf("stdout: This is printed after the fact\n"); fprintf(stderr,"Stderr: prints out\n"); } ------- It has this output: Starts out fine iob[1]._flag 74 iob[1]._flag 10 Stderr: prints out stdout: This is printed after the fact