rjh@hare.udev.cdc.com (rj huebsch) (10/04/90)
I tried posting this to comp.sys.sun, but since I've had no
luck getting it there, so I thought I'd try this group.
I've got a curses application that exhibits strange behavior when run
on a Sun (runs fine on a couple other platforms). The problem is
after the sequence {initscr; do-stuff; endwin; do-stuff;initscr}
any subsequent calls to wgetch return -1 immediately without blocking.
(there seems to be an infinite supply of -1's) The following is a
relatively small test case that exhibits the problem.
Please e-mail responses and I'll summarize if there's interest.
============== test case ========================
/*************************** curse.c *********************************/
/* Initialize curses, draw box, wait for input. Upon receiving */
/* input, exit curses, and echo user input to screen. Wait for */
/* <RETURN> and loop back to beginning */
/* */
/* Binary generated with: */
/* cc -g -I/usr/5include curse.c -o curse /usr/5lib/libcurses.a */
/*********************************************************************/
#include <curses.h>
main()
{
int temp;
while(1){
win_on();
temp=wgetch(stdscr);
win_off();
if (temp=='q') {
exit(0);
}else {
fprintf(stderr,"\n\twgetch returned %d\n",temp);
fprintf(stderr,"\n hit Return to continue\n");
while (getchar() != '\n')
;
}
}
}
win_on()
{
initscr();
savetty();
box(stdscr,0,0);
cbreak();
crmode();
noecho();
nonl();
refresh();
}
win_off()
{
nocbreak();
nl();
echo();
erase();
clear();
refresh();
resetty();
endwin();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rick Huebsch E-mail: rjh@udev.cdc.com
Control Data Corporation AT&T: (612) 482-3544