Subject: src/gnu/games/chess/Xchess
To: None <current-users@netbsd.org>
From: Ronald Khoo <ronald@cpm.MY>
List: current-users
Date: 10/21/1994 14:37:35
One of those parts of the distribution that doesn't even compile
and has been getting on my nerves for years :-)  Problem is, I'm not
an X programmer, so I don't know if my fixes make any sense.  In case
anyone wants them, here they are, without warranty.  Don't forget to
build a separate version of gnuchess with -DCHESSTOOL and nondsp.c
if you want to play xchess -c (against the computer) -- I did that
and installed it as 'gnuchess' instead of 'chess' so that xchess could
find it.

Don't even think of mailing me about this -- I don't do X and I don't play
chess, I'm just one of those people who hate a incomplete system :-)
If anyone has a better set of fixes, I'd be grateful if they submitted them
to the NetBSD project :-)

diff -c ../Xchess/Makefile ./Makefile
*** ../Xchess/Makefile	Fri Dec 17 13:56:00 1993
--- ./Makefile	Fri Oct 21 15:18:06 1994
***************
*** 2,13 ****
  
  PROG = xchess
  
! SRCS = board.c button.c clock.c control.c jail.c message.c parse.c popup.c \
         program.c record.c std.c valid.c window.c XCircle.c scrollText.c
  
! CFLAGS += -I. -DDEF_PROGRAM=\"gnuchess\"
  
! LDADD = -L/usr/X386/lib -lX11
  DPADD = /usr/X386/lib/libX11.a
  
  .include <bsd.prog.mk>
--- 2,13 ----
  
  PROG = xchess
  
! SRCS = xchess.c board.c button.c clock.c control.c jail.c message.c parse.c popup.c \
         program.c record.c std.c valid.c window.c XCircle.c scrollText.c
  
! CFLAGS += -I/usr/X386/include -I. -DDEF_PROGRAM=\"/usr/games/gnuchess\"
  
! LDADD = -L/usr/X386/lib -loldX -lX11 -lm -lcompat
  DPADD = /usr/X386/lib/libX11.a
  
  .include <bsd.prog.mk>
diff -c ../Xchess/program.c ./program.c
*** ../Xchess/program.c	Fri Dec 17 13:56:15 1993
--- ./program.c	Fri Oct 21 11:14:08 1994
***************
*** 146,152 ****
  	/* Do a poll... */
  
  	if (!(i = select(32, &rfd, &wfd, &xfd, &notime)) &&
! 			!from->_cnt) {		/* Bad stuff... */
  		if (debug)
  			fprintf(stderr, "poll: nothing\n");
  		return (NULL);
--- 146,152 ----
  	/* Do a poll... */
  
  	if (!(i = select(32, &rfd, &wfd, &xfd, &notime)) &&
! 			!from->_r) {		/* Bad stuff... */
  		if (debug)
  			fprintf(stderr, "poll: nothing\n");
  		return (NULL);
Common subdirectories: ../Xchess/scrollText and ./scrollText
diff -c ../Xchess/scrollText.c ./scrollText.c
*** ../Xchess/scrollText.c	Fri Dec 17 13:56:21 1993
--- ./scrollText.c	Fri Dec 17 13:56:21 1993
***************
*** 629,635 ****
  		   textInfo->bgGC, 
  		   0, 0, BARSIZE, top-1);
      XFillRectangle(display, textInfo->scrollBar,
! 		   DEFAULT_GC, top, BARSIZE - (2*BARBORDER) - 2,
  		   bottom - top);
      XFillRectangle(display, textInfo->scrollBar, DEFAULT_GC,
  		   0, bottom+1, BARSIZE,
--- 629,635 ----
  		   textInfo->bgGC, 
  		   0, 0, BARSIZE, top-1);
      XFillRectangle(display, textInfo->scrollBar,
! 		   DEFAULT_GC, 0, top, BARSIZE - (2*BARBORDER) - 2,
  		   bottom - top);
      XFillRectangle(display, textInfo->scrollBar, DEFAULT_GC,
  		   0, bottom+1, BARSIZE,
***************
*** 1058,1064 ****
      XCopyArea(display, textInfo->arrowMap, textInfo->mainWindow,
  	       textInfo->CursorGC,
  	       0, 0, arrow_width, arrow_height,
! 	       x, y + h - arrow_height, 1);
  
      /* Then draw the stem */
      XDrawLine(display, textInfo->mainWindow, textInfo->CursorGC,
--- 1058,1064 ----
      XCopyArea(display, textInfo->arrowMap, textInfo->mainWindow,
  	       textInfo->CursorGC,
  	       0, 0, arrow_width, arrow_height,
! 	       x, y + h - arrow_height);
  
      /* Then draw the stem */
      XDrawLine(display, textInfo->mainWindow, textInfo->CursorGC,
***************
*** 1573,1579 ****
      /* Clear out bottom space region */
      XClearArea(display, textInfo->mainWindow,
  	       0, textInfo->h - textInfo->bottomSpace,
! 	       textInfo->w, textInfo->bottomSpace);
      
      UpdateExposures(display, textInfo);
      UpdateScroll(display, textInfo);
--- 1573,1579 ----
      /* Clear out bottom space region */
      XClearArea(display, textInfo->mainWindow,
  	       0, textInfo->h - textInfo->bottomSpace,
! 	       textInfo->w, textInfo->bottomSpace, 1);
      
      UpdateExposures(display, textInfo);
      UpdateScroll(display, textInfo);
diff -c ../Xchess/std.c ./std.c
*** ../Xchess/std.c	Fri Dec 17 13:56:22 1993
--- ./std.c	Fri Dec 17 13:56:22 1993
***************
*** 345,351 ****
          char *s;
  {
  	fputs("Internal Error: ", stderr);
! 	_doprnt(s, &args, stderr);
  	putc('\n', stderr);
  
  	kill(getpid(), SIGIOT);
--- 345,351 ----
          char *s;
  {
  	fputs("Internal Error: ", stderr);
! /*	_doprnt(s, &args, stderr); */
  	putc('\n', stderr);
  
  	kill(getpid(), SIGIOT);
diff -c ../Xchess/std.h ./std.h
*** ../Xchess/std.h	Fri Dec 17 13:56:23 1993
--- ./std.h	Fri Dec 17 13:56:23 1993
***************
*** 71,77 ****
  
  extern char *getenv();
  extern int errno;
- extern char *sys_errlist[];
  
  /* Should use BSIZE instead of BUFSIZ... */
  
--- 71,76 ----
diff -c ../Xchess/window.c ./window.c
*** ../Xchess/window.c	Fri Dec 17 13:56:24 1993
--- ./window.c	Fri Oct 21 15:28:27 1994
***************
*** 846,852 ****
  				   xchess_width, xchess_height);
  	cur = XCreatePixmapCursor(win->display, bm, bmask,
  			    &win->cursorcolor,
! 			    &WhitePixel(win->display, 0),
  			    xchess_x_hot, xchess_y_hot);
  	XFreePixmap(win->display, bm);
  	XFreePixmap(win->display, bmask);
--- 846,852 ----
  				   xchess_width, xchess_height);
  	cur = XCreatePixmapCursor(win->display, bm, bmask,
  			    &win->cursorcolor,
! 			    &win->textback,
  			    xchess_x_hot, xchess_y_hot);
  	XFreePixmap(win->display, bm);
  	XFreePixmap(win->display, bmask);

-- 
Me: Ronald Khoo  Food: Roti Chanai  Drink: Tea, weak, milky without sugar
In Malaysia: ronald@cpm.my      +60 3  241 5232  Computer Protocol Malaysia
In England:  ronald@demon.net   +44 81 349 0063  Demon Internet Services