[comp.sources.games] v03i079: xchess - chess display program using X windows, Patch1

games-request@tekred.TEK.COM (01/26/88)

Submitted by: Konstantinos Konstantinides <kk@hpl-opus.HP.COM>
Comp.sources.games: Volume 3, Issue 79
Archive-name: xchess/Patch1

	[The following patches allow xchess to understand the
	 new "level" option in gnuchess.  Include are diffs
	 for xchess.c, program.c and xchess.1.  Just run this
	 file through 'patch' to update your sources.  -br]

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  Patches01
# Wrapped by billr@tekred on Mon Jan 25 11:30:36 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f Patches01 -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"Patches01\"
else
echo shar: Extracting \"Patches01\" \(3108 characters\)
sed "s/^X//" >Patches01 <<'END_OF_Patches01'
X*** xchess.c	Thu Dec 11 09:19:24 1986
X--- new/xchess.c	Mon Jan 25 11:25:15 1988
X***************
X*** 28,34 ****
X  
X  #define USAGE	"xchess [ -d ] [ -f recordfile ] [ -r savedfile ] [ -i ]\n\
X  \t[ -t moves/timeunit ] [ -c ] [ -p program ]  [ -b ] [ -bnw ] [ -s ]\n\
X! \t[ -n ] [ -h host ] [ -v ] [ -R ] [ whitedisplay ] [ blackdisplay ]"
X  
X  #include "xchess.h"
X  
X--- 28,34 ----
X  
X  #define USAGE	"xchess [ -d ] [ -f recordfile ] [ -r savedfile ] [ -i ]\n\
X  \t[ -t moves/timeunit ] [ -c ] [ -p program ]  [ -b ] [ -bnw ] [ -s ]\n\
X! \t[ -n ] [ -h host ] [ -v ] [ -R ] [ whitedisplay ] [ blackdisplay ] [-l level]"
X  
X  #include "xchess.h"
X  
X***************
X*** 40,45 ****
X--- 40,46 ----
X  bool quickflag = false;
X  
X  char *progname = DEF_PROGRAM;
X+ char *level;
X  char *proghost = NULL;
X  char *piecenames[] = { "pawn", "rook", "knight", "bishop", "queen", "king" } ;
X  char *colornames[] = { "white", "black", "none" } ;
X***************
X*** 110,115 ****
X--- 111,123 ----
X  				progname = *av;
X  			else
X  				goto usage;
X+ 
X+ 		} else if (eq(*av, "-l")) {
X+ 			av++; ac --;
X+ 			if (*av)
X+ 				level = *av;
X+ 			else
X+ 				goto usage;
X  		} else if (eq(*av, "-h")) {
X  			av++; ac--;
X  			if (*av)
X***************
X*** 209,215 ****
X  
X  	/* Start the program if necessary. */
X  	if (progflag)
X! 		if (!program_init(progname))
X  			exit(1);
X  	
X  	XSync(0);
X--- 217,223 ----
X  
X  	/* Start the program if necessary. */
X  	if (progflag)
X! 		if (!program_init(progname,level))
X  			exit(1);
X  	
X  	XSync(0);
X*** program.c	Thu Dec 11 09:19:17 1986
X--- new/program.c	Mon Jan 25 11:25:16 1988
X***************
X*** 30,43 ****
X  
X  #include "xchess.h"
X  #include <signal.h>
X  #include <sys/time.h>
X  
X  static int pid;
X  static FILE *from, *to;
X  
X  bool
X! program_init(name)
X! 	char *name;
X  {
X  	int toprog[2], fromprog[2];
X  	char buf[BSIZE];
X--- 30,47 ----
X  
X  #include "xchess.h"
X  #include <signal.h>
X+ #ifdef  hpux
X+ #include <time.h>
X+ #else
X  #include <sys/time.h>
X+ #endif
X  
X  static int pid;
X  static FILE *from, *to;
X  
X  bool
X! program_init(name,level)
X! 	char *name, *level;
X  {
X  	int toprog[2], fromprog[2];
X  	char buf[BSIZE];
X***************
X*** 54,63 ****
X  		close(fromprog[0]);
X  		close(fromprog[1]);
X  		if (proghost)
X! 			execl("/usr/ucb/rsh", "rsh", proghost, name,
X  					(char *) NULL);
X  		else
X! 			execl(name, name, (char *) NULL);
X  		perror(name);
X  		exit(1);
X  	}
X--- 58,67 ----
X  		close(fromprog[0]);
X  		close(fromprog[1]);
X  		if (proghost)
X! 			execl("/usr/ucb/rsh", "remsh", proghost, name,level,
X  					(char *) NULL);
X  		else
X! 			execl(name, name,level, (char *) NULL);
X  		perror(name);
X  		exit(1);
X  	}
X*** xchess.1	Sat Nov 29 17:44:27 1986
X--- new/xchess.1	Mon Jan 25 11:25:18 1988
X***************
X*** 84,89 ****
X--- 84,93 ----
X  .B -R
X  Randomly chose who plays white and who plays black, if two displays are
X  given.
X+ .TP 8
X+ .B -l level
X+ Selects the level of the game. Gnuchess will be forced to make a move
X+ in "level" seconds.  The default is 30 seconds.
X  .SH CONTROLS
X  .PP
X  The window is divided up into several sub-windows.  The pieces are moved by
END_OF_Patches01
if test 3108 -ne `wc -c <Patches01`; then
    echo shar: \"Patches01\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0