Need help with curses

Keith Crews keith at enmasse.UUCP
Thu May 8 06:37:19 AEST 1986


I am a curses novice and am trying to get a program that came
over the net (the game of reversi) to work properly.  The problem
is that the screen flashes whenever a window is updated.  The program
uses 5 non-overlapping windows.  It frequently calls wclear() for a
particular window, puts some info in that window, and then calls
wrefresh() to update the screen.  This causes the entire screen
to be erased and redrawn, rather than just that window.  If the wclear
call is not made, then the flash goes away but the screen gets
garbled.  The program
below is a simple case that exhibits the problem and is based on
the code in reversi.  Please respond by mail and I will post the
answer if it seems to be of general interest.

It seems to me that the problem could be in several areas:

	1)  bug in program
	2)  bug in curses
	3)  missing terminfo entries that curses needs to
	    do the right thing
	4)  terminal is too dumb to ever do the right thing
	5)  this is what it is supposed to do
	6)  other

I am running system V on a 68000.  It is the official Motorola port
of AT&T system V.  I am using a wyse 50 terminal.  terminfo is used
by this curses rather than termcap.  The only other curses-
like program that we have on the system is vi, which works fine.
The program is compiled with cc -o test test.c -lcurses -ltermlib
Thanks in advance!

		Keith Crews


#include <curses.h>
#include <signal.h>
#include <setjmp.h>
#include <sys/types.h>
#include <sys/times.h>
WINDOW	*w1, *w2;
main ()
{
	int finish_up (), i;
	initscr();
	initwindows();
	for (i = 0; i < 2; i++) {
		message(w1, "window 1 %d", i);
		sleep(1);
		message(w2, "window 2 %d", i);
		sleep(1);
	}
	finish_up ();
}
finish_up ()
{
	endwin();
	exit (0);
}
initwindows()
{
	w1 = newwin(3,30,2,10); /* 3 lines, 30 cols, start at line 2, col 10 */
	w2 = newwin(3,30,12,10); /* 3 lines, 30 cols, start at line 12, col 10*/
}
message(w, f, a1)
	WINDOW * w;
	char * f;
	int a1;
{
	wclear(w);
	wprintw(w, f, a1);
	wrefresh(w);
}



More information about the Comp.unix.wizards mailing list