[comp.sources.games] v01i079: kriegspiel - A chess variant, Patch1

games-request@tekred.UUCP (07/06/87)

Submitted by: Steve Schoch <schoch@ames.arpa>
Comp.sources.games: Volume 1, Issue 79
Archive-name: kriegspiel/Patch1

	[This is an official patch from the author.  -br]

	[After my game was posted, I got some bug reports about some
	 stuff I used from 4.3 BSD that is not in 4.2 BSD, Ultrix, or
	 Sun's OS.  Here is a diff to make xks compile under 4.2.]

*** movecycle.c.old	Thu Jul  2 11:10:39 1987
--- movecycle.c	Thu Jul  2 11:13:38 1987
***************
*** 7,13 ****
  #ifdef XKS
  movecycle()
  {
!     fd_set readfds, fds;
      extern int sock;
      int n;
  
--- 7,13 ----
  #ifdef XKS
  movecycle()
  {
!     auto int readfds, fds;
      extern int sock;
      int n;
  
***************
*** 14,27 ****
      XSelectInput(window, ExposeWindow | ExposeRegion |
  	ButtonPressed | ButtonReleased | LeaveWindow | LeftDownMotion |
  	KeyPressed);
!     FD_ZERO(&fds);
!     FD_SET(dpyno(), &fds);
!     FD_SET(sock, &fds);
      for(;;) {
  	while (XPending())
  	    handle_input();
  	readfds = fds;
! 	n = select(FD_SETSIZE, &readfds, 0, 0, 0);
  	if (n < 0) {
  	    if (errno == EINTR)
  		continue;
--- 14,25 ----
      XSelectInput(window, ExposeWindow | ExposeRegion |
  	ButtonPressed | ButtonReleased | LeaveWindow | LeftDownMotion |
  	KeyPressed);
!     fds = 1<<dpyno() | 1<<sock;
      for(;;) {
  	while (XPending())
  	    handle_input();
  	readfds = fds;
! 	n = select(32, &readfds, 0, 0, 0);
  	if (n < 0) {
  	    if (errno == EINTR)
  		continue;
***************
*** 30,40 ****
  	}
  	if (n == 0)
  	    exit(0);
! 	if (FD_ISSET(dpyno(), &readfds))
  	    handle_input();
! 	if (FD_ISSET(sock, &readfds))
  	    if (handle_sock()) {
! 		FD_CLR(sock, &fds);
  		close(sock);
  		sock = -1;
  	    }
--- 28,38 ----
  	}
  	if (n == 0)
  	    exit(0);
! 	if (readfds & 1 << dpyno())
  	    handle_input();
! 	if (readfds & 1 << sock)
  	    if (handle_sock()) {
! 		fds &= ~(1 << sock);
  		close(sock);
  		sock = -1;
  	    }
*** /dev/null	Mon Jul  6 09:58:29 1987
--- patchlevel.h	Mon Jul  6 10:15:23 1987
***************
*** 0 ****
--- 1 ----
+ #define PATCHLEVEL 1