[comp.sys.sequent] curses and stdio buffering

pjm@osiris.cso.uiuc.edu (P.McGuinness) (04/26/91)

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 <stdio.h>
#include <curses.h>
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

pjm@osiris.cso.uiuc.edu (P.McGuinness) (04/26/91)

 

One somewhat important addendum to the original article ....
we are using DYNIX/ptx V1.2.3.

Patrick McGuinness
pjm@osiris.cso.uiuc.edu