Path: uunet!tektronix!tekgen!tekred!games-request From: games-request@tekred.TEK.COM Newsgroups: comp.sources.games Subject: v03i079: xchess - chess display program using X windows, Patch1 Message-ID: <2124@tekred.TEK.COM> Date: 25 Jan 88 19:39:34 GMT Sender: billr@tekred.TEK.COM Lines: 169 Approved: billr@tekred.TEK.COM Submitted by: Konstantinos Konstantinides 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 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 X #include 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 X+ #ifdef hpux X+ #include X+ #else X #include 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