--- sjeng-11.2.orig/debian/dirs +++ sjeng-11.2/debian/dirs @@ -0,0 +1,3 @@ +usr/games +etc +usr/share/games/sjeng --- sjeng-11.2.orig/debian/docs +++ sjeng-11.2/debian/docs @@ -0,0 +1,5 @@ +BUGS +NEWS +README +TODO +THANKS --- sjeng-11.2.orig/debian/control +++ sjeng-11.2/debian/control @@ -0,0 +1,20 @@ +Source: sjeng +Section: games +Priority: optional +Maintainer: Jotam Jr. Trejo +Build-Depends: debhelper (>= 7), autotools-dev, libgdbm-dev, quilt +Standards-Version: 3.8.3 +Homepage: http://sjeng.sourceforge.net + +Package: sjeng +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Suggests: xboard | eboard +Description: chess program that plays many variants + Sjeng is a chess program that plays normal chess and many variants + like crazyhouse, bughouse, suicide (aka giveaway or anti-chess) and + losers. It can also play variants which have the same rules as + normal chess, but a different starting position. It uses the + XBoard/WinBoard interface by Tim Mann, so it can be used with + xboard or eboard. It is also capable of playing on internet chess + servers. --- sjeng-11.2.orig/debian/rules +++ sjeng-11.2/debian/rules @@ -0,0 +1,101 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# Quilt +include /usr/share/quilt/quilt.make + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +CC = gcc +CFLAGS = -Wall -W -g +LDFLAGS = + +# C++ is not used in this version, but configure looks for it +CXX = g++ +CXXFLAGS = -Wall -W -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 + CXXFLAGS += -O0 +else + CFLAGS += -O2 + CXXFLAGS += -O2 +endif + +INSTALL = install +INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755 +INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644 + +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +export CC CFLAGS LDFLAGS CXX CXXFLAGS INSTALL INSTALL_PROGRAM INSTALL_FILE + +config.status: $(QUILT_STAMPFN) configure + dh_testdir + + cp -f /usr/share/misc/config.sub . + cp -f /usr/share/misc/config.guess . + rm -f config.cache + + ./configure --host=$(DEB_HOST_GNU_TYPE) \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr \ + --bindir=\$${prefix}/games \ + --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info + +build: build-stamp +build-stamp: config.status + dh_testdir + $(MAKE) + touch build-stamp + +clean: unpatch + dh_testdir + dh_testroot + rm -rf build-stamp + [ ! -f Makefile ] || $(MAKE) distclean + find \( -name config.sub -o -name config.guess \) -print0 | xargs -0 -r rm -f \; + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + $(MAKE) install prefix=$(CURDIR)/debian/sjeng/usr + $(INSTALL_FILE) sjeng.rc $(CURDIR)/debian/sjeng/etc/sjeng.rc + $(INSTALL_FILE) books/bug.opn books/losers.opn books/suicide.opn \ + $(CURDIR)/debian/sjeng/usr/share/games/sjeng + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installman debian/sjeng.6 + dh_installexamples sjeng.rc + dh_installchangelogs ChangeLog + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- sjeng-11.2.orig/debian/watch +++ sjeng-11.2/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://sjeng.sourceforge.net/ftp/Sjeng-Free-(.*)\.tar\.gz --- sjeng-11.2.orig/debian/README.source +++ sjeng-11.2/debian/README.source @@ -0,0 +1,7 @@ +This package uses quilt to deal with all modifications done by +debian maintainers to the upstream source. Changes are stored in +the source package as diffs in debian/patches and applied during +the build fase. + +For more information about how to use quilt to apply, modify or +remove patchs read: /usr/share/doc/quilt/README.source --- sjeng-11.2.orig/debian/changelog +++ sjeng-11.2/debian/changelog @@ -0,0 +1,81 @@ +sjeng (11.2-8) unstable; urgency=low + + * Apply a patch to satisfy the xboard protocol related to SAN + notation, this to allow sjeng play in crazyhouse variant in + xboard >= 4.4.0, patch by h.g. muller . + Closes: #539718 + * Bump Standards Version to 3.8.3 (no changes needed). + + -- Jotam Jr. Trejo Wed, 26 Aug 2009 14:08:55 -0600 + +sjeng (11.2-7) unstable; urgency=low + + * New maintainer. Closes: #503526 + * Move DH_COMPAT from rules to debian/compat and set to 7. + * Bump debhelper build-dep version to 7. + * Bump Standards Version to 3.8.2. + * Update the Free Software Fundation Address in debian/copyright. + * Make clean not ignore errors. + * Add Homepage. + * Move all changes done by old Maintainers from .diff.gz to + debian/patches, we use quilt now to deal with the patches. + * Update format version number of debian/watch file to 3, upstream + page is up. Closes: #450090 + * Add rules to debian/rules for have config.guess and config.sub + updates out of diff.gz. + * Add autotools-dev and quilt to build-dependency. + + -- Jotam Jr. Trejo Wed, 27 Jun 2009 23:58:17 -0600 + +sjeng (11.2-6) unstable; urgency=low + + * Recompiled against new version of gdbm, updated build deps. + + -- Lukas Geyer Thu, 5 Jun 2003 09:12:08 -0400 + +sjeng (11.2-5) unstable; urgency=low + + * Fixed retracting and undoing of moves in sjeng.c. (Closes: #192902) + * Removed debugging output for fifty moves check. + * Looking for local configuration in ~/.sjeng/sjeng.rc, like the + manpage claims. + + -- Lukas Geyer Thu, 22 May 2003 10:48:37 -0400 + +sjeng (11.2-4) unstable; urgency=low + + * Fixed one more type mismatch in utils.c. + + -- Lukas Geyer Thu, 15 May 2003 15:17:20 -0400 + +sjeng (11.2-3) unstable; urgency=low + + * Made all score variables long int, this hopefully fixes #192902. + * Changed ECacheSize to unsigned. + * Fixed undefined behavior in speed_test(). + * Added debugging output for fifty moves check, disabled by default. + * Updated email address and standards version. + + -- Lukas Geyer Thu, 15 May 2003 10:32:04 -0400 + +sjeng (11.2-2) unstable; urgency=low + + * General code cleanup, fixed several format mismatches in printf(), + added a missing #include , added some missing prototypes + and initializers. + * Added watch file + * Updated standard version to 3.5.6 + * Updated debhelper compatibility level to 4 + + -- Lukas Geyer Thu, 29 Aug 2002 10:31:11 -0400 + +sjeng (11.2-1) unstable; urgency=low + + * Initial Release (closes: #130019). + * rcfile.c: Adjusted configuration file location. + * book.c: Adjusted book locations. + * sjeng.c: Adjusted learning file locations. + * Wrote very basic manpage. + + -- Lukas Geyer Tue, 28 May 2002 14:15:28 -0400 + --- sjeng-11.2.orig/debian/sjeng.6 +++ sjeng-11.2/debian/sjeng.6 @@ -0,0 +1,27 @@ +.\" Hey, EMACS: -*- nroff -*- +.TH SJENG 6 "May 28, 2002" +.SH NAME +sjeng \- Chess program which supports several variants +.SH SYNOPSIS +.B sjeng +.SH DESCRIPTION +Documentation for sjeng is available in /usr/share/doc/sjeng/README. +It is strongly recommended that you use sjeng in combination with some +interface like xboard or eboard. Please read the documentation of +xboard and eboard to find out how to enable variants. +.PP +There are no command line options for sjeng, but sjeng uses a +configuration file, by default /etc/sjeng.rc. If present, the file +~/.sjeng/sjeng.rc in the user's home directory will be read instead of +the system default. A well-documented example configuration can be +found in /usr/share/doc/sjeng/examples/. +.PP +This manual page was written for the Debian distribution because the +original program does not have a manual page. +.SH AUTHOR +Sjeng was written by Gian-Carlo Pascutto , based on +work done by Adrien Regimbald . +.PP +This manual page was written by Lukas Geyer +, for the Debian GNU/Linux system (but may +be used by others). --- sjeng-11.2.orig/debian/compat +++ sjeng-11.2/debian/compat @@ -0,0 +1 @@ +7 --- sjeng-11.2.orig/debian/README.Debian +++ sjeng-11.2/debian/README.Debian @@ -0,0 +1,17 @@ +README for the Debian package of sjeng +-------------------------------------- + +File locations have been changed to adhere to the usual +conventions. The default sjeng.rc is installed in /etc/sjeng.rc, the +opening books are in /usr/share/games/sjeng. When sjeng is started for +the first time, a subdirectory .sjeng is created in the user's home +directory if it is not already present. If this directory contains a +readable file named sjeng.rc, it will be used instead of the system +default. Furthermore, learning files will be placed in .sjeng. + +This version of sjeng does not read or write any files (book, +learning) in the current working directory, as opposed to the upstream +version. (Except for the case, where your working directory is +~/.sjeng or /usr/share/games/sjeng, of course...) + +Lukas Geyer --- sjeng-11.2.orig/debian/copyright +++ sjeng-11.2/debian/copyright @@ -0,0 +1,50 @@ +This package was debianized by Lukas Geyer on +Sat, 25 May 2002 01:02:03 +0200. + +It was downloaded from http://sjeng.sourceforge.net + +Upstream Author: Gian-Carlo Pascutto + +Copyright: (C) 2000-2001 Gian-Carlo Pascutto + +Original copyright notice: +------------------------------------------------------------------- +Copying/Distribution +-------------------- + +Sjeng is Free Software and is licensed under the GNU General +Public License. For more details see the file COPYING that +comes with Sjeng. + +If this file is missing, write to the Free Software Foundation, +Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +Sjeng should have come with source code, or you should have +been given the possibility to obtain it for a charge no more +than the cost of physically performing the source distribution. +If not, please contact gcp@sjeng.org. + +Sjeng includes tablebase accessing code written by Andrew Kadatch +and Eugene Nalimov. This code is contained in the files tbindex.cpp +and tbdecode.h and is copyrighted by them, all rights reserved. +This code does _not_ fall under the GPL. You are hereby given the +additional right to compile and link Sjeng with this code, as well +as to distribute the resulting executable and code under the +conditions of the GPL, except for the files tbindex.cpp and +tbdecode.h, which do not fall under the GPL, but may also be +distributed together with Sjeng. + +The author regrets having to include this non-free code with +Sjeng, but no free replacement of the same quality is available +yet. +------------------------------------------------------------------- + +Additional comments from the Debian maintainer: + +On Debian systems, the text of the GPL is available in +/usr/share/common-licenses/GPL. The files tbindex.cpp and tbdecode.h +are not contained in the source code archive, so this package is free +software completely covered by the GPL license. + +Lukas Geyer + --- sjeng-11.2.orig/debian/patches/sjeng.c.patch +++ sjeng-11.2/debian/patches/sjeng.c.patch @@ -0,0 +1,219 @@ +Author: Lukas Geyer +Description: Adjusted learning file locations. + +--- sjeng-11.2.orig/sjeng.c ++++ sjeng-11.2/sjeng.c +@@ -27,13 +27,18 @@ + + */ + ++#include ++#include ++#include ++#include ++ + #include "sjeng.h" + #include "protos.h" + #include "extvars.h" + #include "config.h" + + char divider[50] = "-------------------------------------------------"; +-move_s dummy = {0,0,0,0,0}; ++move_s dummy = {0,0,0,0,0,0}; + + int board[144], moved[144], ep_square, white_to_move, comp_color, wking_loc, + bking_loc, white_castled, black_castled, result, ply, pv_length[PV_BUFF], +@@ -90,7 +95,7 @@ + FILE *lrn_suicide; + FILE *lrn_losers; + +-int main (int argc, char *argv[]) { ++int main (void) { + + char input[STR_BUFF], *p, output[STR_BUFF]; + char readbuff[STR_BUFF]; +@@ -98,15 +103,19 @@ + int depth = 4; + bool force_mode, show_board; + double nps, elapsed; +- clock_t cpu_start, cpu_end; ++ clock_t cpu_start = 0, cpu_end = 0; + move_s game_history[600]; + move_x game_history_x[600]; +- int is_edit_mode, edit_color; ++ int is_edit_mode, edit_color = 0; + int pingnum; + int braindeadinterface; + int automode; + rtime_t xstart_time; +- ++ char lrn_name[STR_BUFF]; ++ int path_len; ++ struct passwd *pw; ++ struct stat st; ++ + read_rcfile(); + initialize_zobrist(); + +@@ -119,60 +128,88 @@ + if (!init_book()) + printf("No .OPN opening book found.\n"); + +- if ((lrn_standard = fopen ("standard.lrn", "rb+")) == NULL) ++ pw = getpwuid(getuid()); ++ if (pw == NULL) { ++ perror("Unable to get home directory"); ++ exit(1); ++ } ++ path_len = strlen(pw->pw_dir) + strlen("/.sjeng/"); ++ if (path_len + 21 >= STR_BUFF) { ++ fprintf(stderr,"Home directory path too long\n"); ++ exit(1); ++ } ++ strcpy(lrn_name, pw->pw_dir); ++ strcat(lrn_name, "/.sjeng/"); ++ ++ if (stat(lrn_name, &st) < 0) { ++ printf("Trying to create directory %s\n", lrn_name); ++ if (mkdir(lrn_name, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) { ++ perror("Unable to create directory"); ++ exit(1); ++ } ++ } ++ ++ strcpy(lrn_name + path_len, "standard.lrn"); ++ if ((lrn_standard = fopen (lrn_name, "rb+")) == NULL) + { + printf("No standard learn file.\n"); + +- if ((lrn_standard = fopen ("standard.lrn", "wb+")) == NULL) ++ if ((lrn_standard = fopen (lrn_name, "wb+")) == NULL) + { + printf("Error creating standard learn file.\n"); + } + else + { + fclose(lrn_standard); +- lrn_standard = fopen ("standard.lrn", "rb+"); ++ lrn_standard = fopen (lrn_name, "rb+"); + } + } +- if ((lrn_zh = fopen ("bug.lrn", "rb+")) == NULL) ++ ++ strcpy(lrn_name + path_len, "bug.lrn"); ++ if ((lrn_zh = fopen (lrn_name, "rb+")) == NULL) + { + printf("No crazyhouse learn file.\n"); + +- if ((lrn_zh = fopen ("bug.lrn", "wb+")) == NULL) ++ if ((lrn_zh = fopen (lrn_name, "wb+")) == NULL) + { + printf("Error creating crazyhouse learn file.\n"); + } + else + { + fclose(lrn_zh); +- lrn_zh = fopen ("bug.lrn", "rb+"); ++ lrn_zh = fopen (lrn_name, "rb+"); + } + } +- if ((lrn_suicide = fopen ("suicide.lrn", "rb+")) == NULL) ++ ++ strcpy(lrn_name + path_len, "suicide.lrn"); ++ if ((lrn_suicide = fopen (lrn_name, "rb+")) == NULL) + { + printf("No suicide learn file.\n"); + +- if ((lrn_suicide = fopen ("suicide.lrn", "wb+")) == NULL) ++ if ((lrn_suicide = fopen (lrn_name, "wb+")) == NULL) + { + printf("Error creating suicide learn file.\n"); + } + else + { + fclose(lrn_suicide); +- lrn_suicide = fopen ("suicide.lrn", "rb+"); ++ lrn_suicide = fopen (lrn_name, "rb+"); + } + } +- if ((lrn_losers = fopen ("losers.lrn", "rb+")) == NULL) ++ ++ strcpy(lrn_name + path_len, "losers.lrn"); ++ if ((lrn_losers = fopen (lrn_name, "rb+")) == NULL) + { + printf("No losers learn file.\n"); + +- if ((lrn_losers = fopen ("losers.lrn", "wb+")) == NULL) ++ if ((lrn_losers = fopen (lrn_name, "wb+")) == NULL) + { + printf("Error creating losers learn file.\n"); + } + else + { + fclose(lrn_losers); +- lrn_losers = fopen ("losers.lrn", "rb+"); ++ lrn_losers = fopen (lrn_name, "rb+"); + } + } + +@@ -334,10 +371,10 @@ + + printf("Move ordering : %f%%\n", (((float)FHF*100)/(float)(FH+1))); + +- printf("Material score: %d Eval : %d White hand: %d Black hand : %d\n", ++ printf("Material score: %d Eval : %ld White hand: %d Black hand : %d\n", + Material, eval(), white_hand_eval, black_hand_eval); + +- printf("Hash : %X HoldHash : %X\n", hash, hold_hash); ++ printf("Hash : %lX HoldHash : %lX\n", hash, hold_hash); + + /* check to see if we mate our opponent with our current move: */ + if (!result) { +@@ -635,7 +672,7 @@ + } + else if (!strcmp (input, "eval")) { + check_phase(); +- printf("Eval: %d\n", eval()); ++ printf("Eval: %ld\n", eval()); + } + else if (!strcmp (input, "go")) { + comp_color = white_to_move; +@@ -667,7 +704,7 @@ + time_cushion = 0; + } + else if (!strncmp (input, "rating", 6)) { +- sscanf (input+7, "%ld %ld", &my_rating, &opp_rating); ++ sscanf (input+7, "%d %d", &my_rating, &opp_rating); + if (my_rating == 0) my_rating = 2000; + if (opp_rating == 0) opp_rating = 2000; + } +@@ -729,6 +766,7 @@ + printf("Move number : %d\n", move_number); + if (move_number > 0) + { ++ ply = 1; + path_x[0] = game_history_x[--move_number]; + unmake(&game_history[move_number], 0); + reset_piece_square(); +@@ -738,10 +776,12 @@ + else if (!strncmp (input, "remove", 5)) { + if (move_number > 1) + { ++ ply = 1; + path_x[0] = game_history_x[--move_number]; + unmake(&game_history[move_number], 0); + reset_piece_square(); + ++ ply = 1; + path_x[0] = game_history_x[--move_number]; + unmake(&game_history[move_number], 0); + reset_piece_square(); +@@ -789,7 +829,7 @@ + run_epd_testsuite(); + } + else if (!strncmp (input, "st", 2)) { +- sscanf(input+3, "%d", &fixed_time); ++ sscanf(input+3, "%ld", &fixed_time); + fixed_time = fixed_time * 100; + } + else if (!strncmp (input, "book", 4)) { --- sjeng-11.2.orig/debian/patches/ttable.c.patch +++ sjeng-11.2/debian/patches/ttable.c.patch @@ -0,0 +1,51 @@ +Author: Lukas Geyer +Description: Made all score variables long int. +Bugs: #192902 + +--- sjeng-11.2.orig/ttable.c ++++ sjeng-11.2/ttable.c +@@ -110,7 +110,7 @@ + + } + +-void QStoreTT(int score, int alpha, int beta, int best) ++void QStoreTT(long score, long alpha, long beta, int best) + { + unsigned long index; + +@@ -134,7 +134,7 @@ + return; + } + +-void StoreTT(int score, int alpha, int beta, int best, int threat, int depth) ++void StoreTT(long score, long alpha, long beta, int best, int threat, int depth) + { + unsigned long index; + +@@ -216,7 +216,7 @@ + return; + } + +-void LearnStoreTT(int score, unsigned nhash, unsigned hhash, int tomove, int best, int depth) ++void LearnStoreTT(long score, unsigned nhash, unsigned hhash, int tomove, int best, int depth) + { + unsigned long index; + +@@ -242,7 +242,7 @@ + + } + +-int ProbeTT(int *score, int alpha, int beta, int *best, int *threat, int *donull, int depth) ++int ProbeTT(long *score, long alpha, long beta, int *best, int *threat, int *donull, int depth) + { + + unsigned long index; +@@ -328,7 +328,7 @@ + + } + +-int QProbeTT(int *score, int alpha, int beta, int *best) ++int QProbeTT(long *score, long alpha, long beta, int *best) + { + + unsigned long index; --- sjeng-11.2.orig/debian/patches/extvars.h.patch +++ sjeng-11.2/debian/patches/extvars.h.patch @@ -0,0 +1,20 @@ +Author: Lukas Geyer +Description: Changed ECacheSize to unsigned. + +--- sjeng-11.2.orig/extvars.h ++++ sjeng-11.2/extvars.h +@@ -164,7 +164,7 @@ + extern int havercfile; + extern int TTSize; + extern int PBSize; +-extern int ECacheSize; ++extern unsigned int ECacheSize; + + extern int my_rating, opp_rating; + extern int userealholdings; +@@ -190,5 +190,3 @@ + + + +- +- --- sjeng-11.2.orig/debian/patches/book.c.patch +++ sjeng-11.2/debian/patches/book.c.patch @@ -0,0 +1,55 @@ +Author: Lukas Geyer +Description: Adjust book locations (book.c). +--- sjeng-11.2.orig/book.c ++++ sjeng-11.2/book.c +@@ -21,6 +21,8 @@ + + */ + ++#include ++ + #include "sjeng.h" + #include "protos.h" + #include "extvars.h" +@@ -38,6 +40,8 @@ + #define book_solid 4 /* = */ + #define book_murky 5 /* ?! */ + ++#define BOOK_PATH "/usr/share/games/sjeng/" ++ + int init_book (void) { + + /* simply read all the book moves into a book array. The book will be +@@ -63,27 +67,27 @@ + + if (Variant == Normal) + { +- if ((f_book = fopen ("normal.opn", "r")) == NULL) ++ if ((f_book = fopen (BOOK_PATH "normal.opn", "r")) == NULL) + return FALSE; + } + else if (Variant == Crazyhouse) + { +- if ((f_book = fopen ("zh.opn", "r")) == NULL) ++ if ((f_book = fopen (BOOK_PATH "zh.opn", "r")) == NULL) + return FALSE; + } + else if (Variant == Suicide) + { +- if ((f_book = fopen ("suicide.opn", "r")) == NULL) ++ if ((f_book = fopen (BOOK_PATH "suicide.opn", "r")) == NULL) + return FALSE; + } + else if (Variant == Losers) + { +- if ((f_book = fopen ("losers.opn", "r")) == NULL) ++ if ((f_book = fopen (BOOK_PATH "losers.opn", "r")) == NULL) + return FALSE; + } + else + { +- if ((f_book = fopen ("bug.opn", "r")) == NULL) ++ if ((f_book = fopen (BOOK_PATH "bug.opn", "r")) == NULL) + return FALSE; + } + --- sjeng-11.2.orig/debian/patches/rcfile.c.patch +++ sjeng-11.2/debian/patches/rcfile.c.patch @@ -0,0 +1,73 @@ +Author: Lukas Geyer +Description: Adjusted configuration file location. + +--- sjeng-11.2.orig/rcfile.c ++++ sjeng-11.2/rcfile.c +@@ -21,16 +21,24 @@ + + */ + ++#include ++#include ++#include ++ + #include "sjeng.h" + #include "protos.h" + #include "extvars.h" + #include "config.h" + ++/* Local name is relative to user's home directory */ ++#define RC_LOCALNAME "/.sjeng/sjeng.rc" ++#define RC_GLOBALNAME "/etc/sjeng.rc" ++ + FILE *rcfile; + char line[STR_BUFF]; + + int TTSize; +-int ECacheSize; ++unsigned int ECacheSize; + int PBSize; + + int cfg_booklearn; +@@ -51,8 +59,22 @@ + { + int i; + unsigned int setc; +- +- if ((rcfile = fopen ("sjeng.rc", "r")) == NULL) ++ struct passwd *pw; ++ char rcname[STR_BUFF]; ++ ++ rcfile = NULL; ++ pw = getpwuid(getuid()); ++ if (pw != NULL && ++ strlen(pw->pw_dir) + strlen(RC_LOCALNAME) + 1 < STR_BUFF ) { ++ strcpy(rcname, pw->pw_dir); ++ strcat(rcname, RC_LOCALNAME); ++ rcfile = fopen(rcname, "r"); ++ } ++ if (rcfile == NULL) { ++ rcfile = fopen(RC_GLOBALNAME, "r"); ++ } ++ ++ if (rcfile == NULL) + { + printf("No configuration file!\n"); + +@@ -100,7 +122,7 @@ + + fgets(line, STR_BUFF, rcfile); + while (line[0] == '#') fgets(line, STR_BUFF, rcfile); +- sscanf(line, "%d", &ECacheSize); ++ sscanf(line, "%u", &ECacheSize); + + fgets(line, STR_BUFF, rcfile); + while (line[0] == '#') fgets(line, STR_BUFF, rcfile); +@@ -181,6 +203,7 @@ + + sprintf(setcode, "%u", setc); + ++ fclose(rcfile); + initialize_eval(); + alloc_hash(); + alloc_ecache(); --- sjeng-11.2.orig/debian/patches/moves.c.patch +++ sjeng-11.2/debian/patches/moves.c.patch @@ -0,0 +1,14 @@ +Author: Lukas Geyer +Description: General code cleanup. + +--- sjeng-11.2.orig/moves.c ++++ sjeng-11.2/moves.c +@@ -31,7 +31,7 @@ + int numb_moves; + static move_s *genfor; + +-int fcaptures; ++bool fcaptures; + int gfrom; + + int kingcap; /* break if we capture the king */ --- sjeng-11.2.orig/debian/patches/epd.c.patch +++ sjeng-11.2/debian/patches/epd.c.patch @@ -0,0 +1,51 @@ +Author: Lukas Geyer +Description: Fixed format mismatches in printf(). + +--- sjeng-11.2.orig/epd.c ++++ sjeng-11.2/epd.c +@@ -24,6 +24,7 @@ + #include "sjeng.h" + #include "protos.h" + #include "extvars.h" ++#include + + void setup_epd_line(char* inbuff) + { +@@ -243,6 +244,10 @@ + thinktime *= 100; + + testsuite = fopen(testname, "r"); ++ if (testsuite==NULL) { ++ fprintf(stderr, "Cannot open file %s: %s\n", testname, strerror(errno)); ++ return; ++ } + + while (fgets(readbuff, 2000, testsuite) != NULL) + { +@@ -264,8 +269,8 @@ + // cpu_end = clock(); + // rdelay(2); + +- elapsed = (cpu_end-cpu_start)/(double) CLOCKS_PER_SEC; +- printf("Time: %f\n", elapsed); ++ // elapsed = (cpu_end-cpu_start)/(double) CLOCKS_PER_SEC; ++ // printf("Time: %f\n", elapsed); + + if (interrupt()) rinput(tempbuff, STR_BUFF, stdin); + +@@ -304,7 +309,7 @@ + + printf("Move ordering : %f%%\n", (((float)FHF*100)/(float)FH+1)); + +- printf("Material score: %d Eval : %d\n", Material, eval()); ++ printf("Material score: %d Eval : %ld\n", Material, eval()); + printf("\n"); + + if (!forcedwin) +@@ -329,5 +334,6 @@ + }; + + printf("\n"); ++ fclose(testsuite); + }; + --- sjeng-11.2.orig/debian/patches/neval.c.patch +++ sjeng-11.2/debian/patches/neval.c.patch @@ -0,0 +1,23 @@ +Author: Lukas Geyer +Description: General code cleanup. + +--- sjeng-11.2.orig/neval.c ++++ sjeng-11.2/neval.c +@@ -177,7 +177,7 @@ + int in_cache; + int wp = 0, bp = 0, wn = 0, bn = 0, wb = 0, bb = 0, + wq = 0, bq = 0, wr = 0, br = 0; +- int fwrook, fbrook, rwrook, rbrook; ++ int fwrook = 0, fbrook = 0, rwrook = 0, rbrook = 0; + int wpotential = 0, bpotential = 0, tmp; + + in_cache = 0; +@@ -818,7 +818,7 @@ + int in_cache; + int wp = 0, bp = 0, wn = 0, bn = 0, wb = 0, bb = 0, + wq = 0, bq = 0, wr = 0, br = 0; +- int rbrook, fbrook, rwrook,fwrook; ++ int rbrook = 0, fbrook = 0, rwrook = 0,fwrook = 0; + + in_cache = 0; + --- sjeng-11.2.orig/debian/patches/seval.c.patch +++ sjeng-11.2/debian/patches/seval.c.patch @@ -0,0 +1,54 @@ +Author: Lukas Geyer +Description: General code cleanup. + +--- sjeng-11.2.orig/seval.c ++++ sjeng-11.2/seval.c +@@ -121,8 +121,6 @@ + + static int black_saccers(int square) + { +- register int ndir, a_sq; +- register int basq, i; + register int f = FALSE; + + /* for white pawn on square, any black +@@ -148,8 +146,8 @@ + f = TRUE; + } + else if (rank(square) == 4 && +- board[square + 35] == bpawn || +- board[square + 37] == bpawn) ++ (board[square + 35] == bpawn || ++ board[square + 37] == bpawn)) + { + f = TRUE; + } +@@ -205,8 +203,6 @@ + /* for black pawn on square, any black + * pieces that can sac themselves to it? */ + +- register int ndir, a_sq; +- register int basq, i; + register int f = FALSE; + + /* for white pawn on square, any black +@@ -232,8 +228,8 @@ + f = TRUE; + } + else if (rank(square) == 5 && +- board[square - 35] == wpawn || +- board[square - 37] == wpawn) ++ (board[square - 35] == wpawn || ++ board[square - 37] == wpawn)) + { + f = TRUE; + } +@@ -298,7 +294,7 @@ + int isolated, backwards, i, a, j; + long int score = 0; + int in_cache; +- int wb = 0, bb = 0, wbc, bbc; ++ int wb = 0, bb = 0, wbc = 0, bbc = 0; + int wk = 0, bk = 0, wr = 0, br = 0; + int wn = 0, bn = 0, wp = 0, bp = 0; + --- sjeng-11.2.orig/debian/patches/utils.c.patch +++ sjeng-11.2/debian/patches/utils.c.patch @@ -0,0 +1,33 @@ +Author: Lukas Geyer +Description: General code cleanup. + +--- sjeng-11.2.orig/utils.c ++++ sjeng-11.2/utils.c +@@ -529,7 +529,8 @@ + + void hash_extract_pv(int level, char str[]) + { +- int dummy, bm; ++ int bm, dummy_int; ++ long dummy_long; + move_s moves[MOVE_BUFF]; + int num_moves; + char output[STR_BUFF]; +@@ -538,7 +539,7 @@ + level--; + if (!level) return; + +- if(ProbeTT(&dummy, 0, 0, &bm, &dummy, &dummy, 0) != HMISS) ++ if(ProbeTT(&dummy_long, 0, 0, &bm, &dummy_int, &dummy_int, 0) != HMISS) + { + gen(&moves[0]); + num_moves = numb_moves; +@@ -1342,7 +1343,7 @@ + { + eval(); + /* invalidate the ecache */ +- hash = (++hash) % ULONG_MAX; ++ ++hash; + } + + cpu_end = clock (); --- sjeng-11.2.orig/debian/patches/series +++ sjeng-11.2/debian/patches/series @@ -0,0 +1,20 @@ +xbprotosan.patch +book.c.patch +ecache.c.patch +epd.c.patch +extvars.h.patch +learn.c.patch +leval.c.patch +moves.c.patch +neval.c.patch +newbook.c.patch +probe.c.patch +proof.c.patch +protos.h.patch +rcfile.c.patch +search.c.patch +segtb.c.patch +seval.c.patch +sjeng.c.patch +ttable.c.patch +utils.c.patch --- sjeng-11.2.orig/debian/patches/segtb.c.patch +++ sjeng-11.2/debian/patches/segtb.c.patch @@ -0,0 +1,19 @@ +Author: Lukas Geyer +Description: General code cleanup. + +--- sjeng-11.2.orig/segtb.c ++++ sjeng-11.2/segtb.c +@@ -742,10 +742,10 @@ + + int egtb(int s) + { +- int w1_man, w2_man, b1_man, b2_man; +- int w1, w2, b1, b2; ++ int w1_man = 0, w2_man = 0, b1_man = 0, b2_man = 0; ++ int w1 = 0, w2 = 0, b1 = 0, b2 = 0; + int w_count = 0, b_count = 0; +- int i, t, temp, junk, bpc; ++ int i, t, temp, junk = 0, bpc; + signed char *table; + + /* first figure out what kind of position we have */ --- sjeng-11.2.orig/debian/patches/proof.c.patch +++ sjeng-11.2/debian/patches/proof.c.patch @@ -0,0 +1,58 @@ +Author: Lukas Geyer +Description: General code cleanup, fixed several format mismatches in printf(). + +--- sjeng-11.2.orig/proof.c ++++ sjeng-11.2/proof.c +@@ -79,7 +79,7 @@ + void losers_pn_eval (node_t *this); + + unsigned char *membuff; +-int bufftop = 0; ++unsigned int bufftop = 0; + + void* Xmalloc(int size) + { +@@ -506,7 +506,6 @@ + int i; + move_s moves[MOVE_BUFF]; + int l, num_moves; +- int reploop; + int ic; + + if (node->expanded) +@@ -1024,7 +1023,7 @@ + node_t *root; + node_t *mostproving; + node_t *currentnode; +- int leastlooked, leastlooked_l, leastlooked_i; ++ int leastlooked, leastlooked_l = 0, leastlooked_i = 0; + int losers; + int xnodecount; + int firsts, alternates; +@@ -1364,7 +1363,7 @@ + #endif + { + #ifdef PN2 +- printf("P: %d D: %d N: %d S: %d Mem: %2.2fM Iters: %d ", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof(node_t) / (float)(1024*1024))), iters); ++ printf("P: %d D: %d N: %d S: %ld Mem: %2.2fM Iters: %d ", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof(node_t) / (float)(1024*1024))), iters); + + printf ("PV: "); + +@@ -1415,7 +1414,7 @@ + } + }; + +- printf ("P: %d D: %d N: %d S: %d Mem: %2.2fM Iters: %d MaxDepth: %d\n", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof (node_t) / (float) (1024 * 1024))), iters,maxply); ++ printf ("P: %d D: %d N: %d S: %ld Mem: %2.2fM Iters: %d MaxDepth: %d\n", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof (node_t) / (float) (1024 * 1024))), iters,maxply); + + if (xb_mode && post) + printf ("tellics whisper proof %d, disproof %d, %d nodes, %d forwards, %d iters, highest depth %d\n", root->proof, root->disproof, nodecount, forwards, iters, maxply); +@@ -1608,7 +1607,7 @@ + } + }; + +- printf("P: %d D: %d N: %d S: %d Mem: %2.2fM Iters: %d\n", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof(node_t) / (float)(1024*1024))), iters); ++ printf("P: %d D: %d N: %d S: %ld Mem: %2.2fM Iters: %d\n", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof(node_t) / (float)(1024*1024))), iters); + + while(currentnode != root) + { --- sjeng-11.2.orig/debian/patches/ecache.c.patch +++ sjeng-11.2/debian/patches/ecache.c.patch @@ -0,0 +1,43 @@ +Author: Lukas Geyer +Description: Made all score variables long int, + fixed format mismatches in printf(). +Bugs: #192902 + +--- sjeng-11.2.orig/ecache.c ++++ sjeng-11.2/ecache.c +@@ -29,7 +29,7 @@ + { + unsigned long stored_hash; + unsigned long hold_hash; +-unsigned int score; ++long int score; + } ECacheType; + + /*ECacheType ECache[ECACHESIZE];*/ +@@ -40,7 +40,7 @@ + + void storeECache(long int score) + { +- int index; ++ unsigned int index; + + index = hash % ECacheSize; + +@@ -51,7 +51,7 @@ + + void checkECache(long int *score, int *in_cache) + { +- int index; ++ unsigned int index; + + ECacheProbes++; + +@@ -84,7 +84,7 @@ + exit(EXIT_FAILURE); + } + +- printf("Allocated %lu eval cache entries, totalling %lu bytes.\n", ++ printf("Allocated %u eval cache entries, totalling %zu bytes.\n", + ECacheSize, sizeof(ECacheType)*ECacheSize); + return; + } --- sjeng-11.2.orig/debian/patches/search.c.patch +++ sjeng-11.2/debian/patches/search.c.patch @@ -0,0 +1,177 @@ +Author: Lukas Geyer +Description: General code cleanup. + +--- sjeng-11.2.orig/search.c ++++ sjeng-11.2/search.c +@@ -264,7 +264,7 @@ + } + + +-long int qsearch (int alpha, int beta, int depth) { ++long int qsearch (long alpha, long beta, int depth) { + + /* perform a quiscense search on the current node using alpha-beta with + negamax search */ +@@ -275,9 +275,10 @@ + move_ordering[MOVE_BUFF], + see_values[MOVE_BUFF]; + bool legal_move, no_moves = TRUE; +- int sbest, best_score, best, delta, bound; +- int originalalpha; +- int oldtime; ++ long best_score, bound, delta; ++ int sbest, best; ++ long originalalpha; ++ long int oldtime; + int seev; + + pv_length[ply] = ply; +@@ -301,7 +302,7 @@ + extendedtime = 1; + oldtime = time_for_move; + time_for_move += allocate_time(); +- printf("Extended from %d to %d, time left %d\n", oldtime, ++ printf("Extended from %ld to %ld, time left %ld\n", oldtime, + time_for_move, + time_left); + } +@@ -473,7 +474,7 @@ + + } + +-long int search (int alpha, int beta, int depth, int is_null) { ++long int search (long alpha, long beta, int depth, int is_null) { + + /* search the current node using alpha-beta with negamax search */ + +@@ -481,16 +482,18 @@ + int num_moves, i, j; + long int score = -INF, move_ordering[MOVE_BUFF], see_values[MOVE_BUFF]; + bool no_moves, legal_move; +- int bound, threat, donull, best, sbest, best_score, old_ep; ++ long int best_score, bound; ++ int threat, donull, best, sbest, old_ep; + bool incheck, first; +- int extend, fscore, fmax, selective; ++ long int fscore, fmax; ++ int extend, selective; + move_s kswap; + int ksswap; +- int originalalpha; ++ long originalalpha; + int afterincheck; + int legalmoves; + int dropcut; +- int oldtime; ++ long int oldtime; + int egscore; + static const int rc_index[14] = {0,1,1,2,2,5,5,3,3,4,4,2,2,0}; + +@@ -512,7 +515,7 @@ + extendedtime = 1; + oldtime = time_for_move; + time_for_move += allocate_time(); +- printf("Extended from %d to %d, time left %d\n", oldtime, ++ printf("Extended from %ld to %ld, time left %ld\n", oldtime, + time_for_move, + time_left); + } +@@ -826,11 +829,12 @@ + afterincheck = f_in_check(&moves[0], i); + checks[ply] = afterincheck; + +- if (!afterincheck && ((Variant == Normal) +- || (Variant == Suicide) +- || (Variant == Losers)) && (depth < 3) && +- (((board[moves[i].target] == wpawn) && (rank(moves[i].target) >= 6) +- || ((board[moves[i].target] == bpawn) && (rank(moves[i].target) <= 3))))) ++ if (!afterincheck ++ && ((Variant == Normal) || (Variant == Suicide) || (Variant == Losers)) ++ && (depth < 3) ++ && (((board[moves[i].target] == wpawn) && (rank(moves[i].target) >= 6)) ++ || ++ ((board[moves[i].target] == bpawn) && (rank(moves[i].target) <= 3)))) + { + extend++; + }; +@@ -1066,7 +1070,7 @@ + } + + +-move_s search_root (int originalalpha, int originalbeta, int depth) { ++move_s search_root (long originalalpha, long originalbeta, int depth) { + + /* search the root node using alpha-beta with negamax search */ + +@@ -1074,7 +1078,7 @@ + int num_moves, i, j; + long int root_score = -INF, move_ordering[MOVE_BUFF], see_values[MOVE_BUFF]; + bool no_moves, legal_move, first; +- int alpha, beta; ++ long alpha, beta; + move_s kswap; + move_s oldbest; + int oldbestnum; +@@ -1447,15 +1451,15 @@ + + move_s comp_move, temp_move, old_move; + int i, j, k; +- long int elapsed, temp_score, true_score; ++ long int elapsed, temp_score = 0, true_score; + char postmove[STR_BUFF]; + clock_t cpu_start, cpu_end; + float et = 0; +- int alpha, beta; ++ long alpha, beta; + int tmptmp; + int rs; + move_s moves[MOVE_BUFF]; +- int l, lastlegal, ic; ++ int l, lastlegal = 0, ic; + int pn_restart; + int num_moves; + char output[8]; +@@ -1632,7 +1636,7 @@ + + if (pn_restart) time_for_move = (float)time_for_move * (float)2/((float)pn_restart+1.0); + +- printf("Time for move : %d\n", time_for_move); ++ printf("Time for move : %ld\n", time_for_move); + + if (time_for_move > 50) + LoadLearn(); +@@ -1658,6 +1662,7 @@ + if ((forcedwin || result) && (pn_move.target != dummy.target) + && !is_analyzing) + { ++ cpu_start = clock(); + comp_move = pn_move; + } + else +@@ -1861,7 +1866,7 @@ + break; + } + } +- for (j = 0; j < num_moves; j++) ++ for (j = 0, k = 0; j < num_moves; j++) + { + if (rootlosers[j]) k++; + } +@@ -1883,7 +1888,7 @@ + } + elapsed = rdifftime (rtime (), start_time); + +- printf("Used time : %d\n", elapsed); ++ printf("Used time : %ld\n", elapsed); + + /* update our elapsed time_cushion: */ + if (moves_to_tc && !is_pondering) { +@@ -1937,7 +1942,7 @@ + + if ((et > 0) && (Variant != Bughouse)) + { +- printf("tellics whisper d%d %+.2f %sn: %ld qp: %.0f%% fh: %.0f%% c-x: %d r-x: %d 1-x: %d egtb: %d time: %.2f nps: %ld\n", ++ printf("tellics whisper d%d %+.2f %sn: %ld qp: %.0f%% fh: %.0f%% c-x: %ld r-x: %ld 1-x: %ld egtb: %d time: %.2f nps: %ld\n", + true_i_depth, (float)temp_score/100.0, postpv, nodes, + (((float)qnodes*100)/((float)nodes+1)), + ((float)FHF*100)/((float)(FH+1)), --- sjeng-11.2.orig/debian/patches/protos.h.patch +++ sjeng-11.2/debian/patches/protos.h.patch @@ -0,0 +1,57 @@ +Author: Lukas Geyer +Description: Made all score variables long int. +Bugs: #192902 + +--- sjeng-11.2.orig/protos.h ++++ sjeng-11.2/protos.h +@@ -67,7 +67,7 @@ + + + void push_slidE (int target); +-long int qsearch (int alpha, int beta, int depth); ++long int qsearch (long alpha, long beta, int depth); + void rdelay (int time_in_s); + long int rdifftime (rtime_t end, rtime_t start); + bool remove_one (int *marker, long int move_ordering[], int num_moves); +@@ -75,8 +75,8 @@ + void check_piece_square (void); + void rinput (char str[], int n, FILE *stream); + rtime_t rtime (void); +-long int search (int alpha, int beta, int depth, int is_null); +-move_s search_root (int alpha, int beta, int depth); ++long int search (long alpha, long beta, int depth, int is_null); ++move_s search_root (long alpha, long beta, int depth); + void start_up (void); + move_s think (void); + void toggle_bool (bool *var); +@@ -111,14 +111,14 @@ + move_s choose_book_move(void); + move_s choose_binary_book_move(void); + +-void StoreTT(int score, int alpha, int beta, int best , int threat, int depth); +-void QStoreTT(int score, int alpha, int beta, int best); +-int ProbeTT(int *score, int alpha, int beta, int *best, int *threat, int *donull, int depth); +-int QProbeTT(int *score, int alpha, int beta, int *best); +-void LearnStoreTT(int score, unsigned nhash, unsigned hhash, int tomove, int best, int depth); ++void StoreTT(long score, long alpha, long beta, int best , int threat, int depth); ++void QStoreTT(long score, long alpha, long beta, int best); ++int ProbeTT(long *score, long alpha, long beta, int *best, int *threat, int *donull, int depth); ++int QProbeTT(long *score, long alpha, long beta, int *best); ++void LearnStoreTT(long score, unsigned nhash, unsigned hhash, int tomove, int best, int depth); + + void LoadLearn(void); +-void Learn(int score, int best, int depth); ++void Learn(long score, int best, int depth); + + void pinput (int n, FILE *stream); + +@@ -170,5 +170,9 @@ + void gen_all_tables(void); + int egtb(int s); + ++int load_2piece(void); ++int load_3piece(int w1_man, int b1_man, int b2_man, signed char *t); ++int init_segtb(void); ++ + #endif + --- sjeng-11.2.orig/debian/patches/newbook.c.patch +++ sjeng-11.2/debian/patches/newbook.c.patch @@ -0,0 +1,60 @@ +Author: Lukas Geyer +Description: Made all score variables long int, also + fixed several format mismatches in fprintf(): +Bugs: #192902 + +--- sjeng-11.2.orig/newbook.c ++++ sjeng-11.2/newbook.c +@@ -43,7 +43,7 @@ + typedef struct + { + unsigned long played; +- signed long score; ++ long int score; + } posinfo_t; + + typedef struct +@@ -118,7 +118,6 @@ + posinfo_t *pst; + datum index; + datum data; +- int win = 0, loss = 0; + int ret; + + /* fill in the key field */ +@@ -461,7 +460,7 @@ + int raw; + int num_moves, i; + char output[6]; +- signed long scores[MOVE_BUFF], best_score = 0; ++ long int scores[MOVE_BUFF], best_score = 0; + + srand(time(0)); + +@@ -524,7 +523,7 @@ + + comp_to_coord(moves[i], output); + +- printf("Move %s: %ld times played, %d learned\n", output, ++ printf("Move %s: %ld times played, %ld learned\n", output, + ps->played, ps->score); + + if ((ps->played + ps->score) >= PLAYTHRESHOLD) +@@ -593,7 +592,7 @@ + + void book_learning(int result) + { +- GDBM_FILE binbook; ++ GDBM_FILE binbook = NULL; + hashkey_t key; + posinfo_t *ps; + datum index; +@@ -675,7 +674,7 @@ + } + + /* don't 'overlearn' */ +- if (abs((ps->score)+pi) < (ps->played*5)) ++ if ((unsigned long)labs((ps->score)+pi) < (ps->played*5)) + { + + printf("Learning opening %lu, played %lu, old score %ld, new score %ld\n", --- sjeng-11.2.orig/debian/patches/leval.c.patch +++ sjeng-11.2/debian/patches/leval.c.patch @@ -0,0 +1,21 @@ +Author: Lukas Geyer +Description: General code cleanup, added initializers. + +--- sjeng-11.2.orig/leval.c ++++ sjeng-11.2/leval.c +@@ -120,13 +120,13 @@ + long int losers_eval (void) { + + /* return a score for the current middlegame position: */ +- int srank, pawn_file, pawns[2][11], white_back_pawn[11], black_back_pawn[11]; ++ int srank = 0, pawn_file = 0, pawns[2][11], white_back_pawn[11], black_back_pawn[11]; + int isolated, backwards; + int i, a, j; + long int score = 0; + int in_cache; + int wp = 0, bp = 0; +- int wks, bks; ++ int wks = 0, bks = 0; + int wpassp = 0, bpassp = 0; + int wpawns = 0, bpawns = 0; + --- sjeng-11.2.orig/debian/patches/probe.c.patch +++ sjeng-11.2/debian/patches/probe.c.patch @@ -0,0 +1,23 @@ +Author: Lukas Geyer +Description: General code cleanup. + +--- sjeng-11.2.orig/probe.c ++++ sjeng-11.2/probe.c +@@ -121,7 +121,8 @@ + #endif + } + +-const static int EGTranslate(int sqidx) ++#ifdef USE_EGTB ++static int EGTranslate(int sqidx) + { + int r; + +@@ -129,6 +130,7 @@ + + return r; + } ++#endif + + int probe_egtb(void) + { --- sjeng-11.2.orig/debian/patches/xbprotosan.patch +++ sjeng-11.2/debian/patches/xbprotosan.patch @@ -0,0 +1,16 @@ +Author: Jotam Jr. Trejo +Description: Initialize type_to_char table to only upper-case characters, + this to comply the xboard version 2 protocol, related to + SAN notation. +Closes: 539718. +--- a/utils.c ++++ b/utils.c +@@ -313,7 +313,7 @@ + int prom, from, target, f_rank, t_rank, converter; + char f_file, t_file; + +- char type_to_char[] = { 'F', 'P', 'p', 'N', 'n', 'K', 'k', 'R', 'r', 'Q', 'q', 'B', 'b', 'E' }; ++ char type_to_char[] = { 'F', 'P', 'P', 'N', 'N', 'K', 'K', 'R', 'R', 'Q', 'Q', 'B', 'B', 'E' }; + + prom = move.promoted; + from = move.from; --- sjeng-11.2.orig/debian/patches/learn.c.patch +++ sjeng-11.2/debian/patches/learn.c.patch @@ -0,0 +1,30 @@ +Author: Lukas Geyer +Description: Made all score variables long int. +Bugs: #192902 + +--- sjeng-11.2.orig/learn.c ++++ sjeng-11.2/learn.c +@@ -36,13 +36,13 @@ + } + LearnType; + +-void Learn(int score, int best, int depth) ++void Learn(long score, int best, int depth) + { + int number = 0, next = 0; + LearnType draft; + FILE **lrnfile; + +- printf("Learning score: %d best: %d depth:%d hash: %X\n", score, best, depth, hash); ++ printf("Learning score: %ld best: %d depth:%d hash: %lX\n", score, best, depth, hash); + + if (Variant == Normal) + { +@@ -122,6 +122,7 @@ + { + lrnfile = &lrn_losers; + } ++ else return; // Can this happen? + + fseek(*lrnfile, 0, SEEK_SET); + fread(&number, sizeof(int), 1, *lrnfile);