diff -ru crafty-orig/Makefile crafty/Makefile --- crafty-orig/Makefile Mon Feb 16 10:53:15 2004 +++ crafty/Makefile Sun Mar 21 01:19:38 2004 @@ -146,7 +146,9 @@ CXFLAGS=$(CFLAGS) \ LDFLAGS=$(LDFLAGS) \ LIBS='-lstdc++' \ - opt='$(opt) -DFUTILITY -DFAST' \ + opt='$(opt) -DFUTILITY -DFAST \ + -DBOOKDIR=\"$(prefix)/lib/crafty\" \ + -DTBDIR=\"$(prefix)/lib/crafty/TB\"' \ crafty-make freebsd: diff -ru crafty-orig/chess.h crafty/chess.h --- crafty-orig/chess.h Sat Feb 21 19:53:51 2004 +++ crafty/chess.h Sun Mar 21 01:03:12 2004 @@ -134,6 +134,9 @@ #if !defined(BOOKDIR) # define BOOKDIR "." #endif +#if !defined(LEARNDIR) +# define LEARNDIR "." +#endif #if !defined(LOGDIR) # define LOGDIR "." #endif diff -ru crafty-orig/data.c crafty/data.c --- crafty-orig/data.c Sat Feb 21 19:53:51 2004 +++ crafty/data.c Sun Mar 21 01:03:58 2004 @@ -319,6 +319,7 @@ int new_game = 0; char channel_title[32] = { "" }; char book_path[128] = { BOOKDIR }; +char learn_path[128] = { LEARNDIR }; char log_path[128] = { LOGDIR }; char tb_path[128] = { TBDIR }; char rc_path[128] = { RCDIR }; diff -ru crafty-orig/data.h crafty/data.h --- crafty-orig/data.h Sat Feb 21 19:53:51 2004 +++ crafty/data.h Sun Mar 21 01:04:30 2004 @@ -96,6 +96,7 @@ extern int channel; extern char channel_title[32]; extern char book_path[128]; +extern char learn_path[128]; extern char log_path[128]; extern char tb_path[128]; extern char rc_path[128]; diff -ru crafty-orig/init.c crafty/init.c --- crafty-orig/init.c Sat Feb 21 19:53:51 2004 +++ crafty/init.c Sun Mar 21 01:07:06 2004 @@ -169,15 +169,15 @@ books_file = 0; } } - sprintf(log_filename, "%s/book.lrn", book_path); + sprintf(log_filename, "%s/book.lrn", learn_path); book_lrn_file = fopen(log_filename, "a"); if (!book_lrn_file) { - Print(128, "unable to open book learning file [%s/book.lrn].\n", book_path); + Print(128, "unable to open book learning file [%s/book.lrn].\n", learn_path); Print(128, "learning disabled.\n"); learning &= ~(book_learning + result_learning); } if (learning & position_learning) { - sprintf(log_filename, "%s/position.bin", book_path); + sprintf(log_filename, "%s/position.bin", learn_path); position_file = fopen(log_filename, "rb+"); if (position_file) { fseek(position_file, 0, SEEK_END); @@ -195,19 +195,19 @@ fwrite(&i, sizeof(int), 1, position_file); } else { Print(128, "unable to open position learning file [%s/position.bin].\n", - book_path); + learn_path); Print(128, "learning disabled.\n"); learning &= ~position_learning; } } - sprintf(log_filename, "%s/position.lrn", book_path); + sprintf(log_filename, "%s/position.lrn", learn_path); position_lrn_file = fopen(log_filename, "r"); if (!position_lrn_file) { position_lrn_file = fopen(log_filename, "a"); if (position_lrn_file) fprintf(position_lrn_file, "position\n"); else { Print(128, "unable to open position learning file [%s/position.bin].\n", - book_path); + learn_path); Print(128, "learning disabled.\n"); learning &= ~position_learning; } diff -ru crafty-orig/learn.c crafty/learn.c --- crafty-orig/learn.c Sat Feb 21 19:53:51 2004 +++ crafty/learn.c Sun Mar 21 01:07:42 2004 @@ -545,7 +545,7 @@ int index[32768], i, j, cluster; fclose(book_lrn_file); - sprintf(text, "%s/book.lrn", book_path); + sprintf(text, "%s/book.lrn", learn_path); book_lrn_file = fopen(text, "w"); fseek(book_file, 0, SEEK_SET); fread(index, sizeof(int), 32768, book_file); @@ -885,15 +885,15 @@ } if (nargs > 1 && !strcmp(args[1], "clear")) { fclose(position_file); - sprintf(text, "%s/position.lrn", book_path); + sprintf(text, "%s/position.lrn", learn_path); position_lrn_file = fopen(text, "w"); if (!position_lrn_file) { printf("unable to open position learning file [%s/position.lrn].\n", - book_path); + learn_path); return; } fprintf(position_lrn_file, "position\n"); - sprintf(text, "%s/position.bin", book_path); + sprintf(text, "%s/position.bin", learn_path); position_file = fopen(text, "wb+"); if (position_file) { i = 0; @@ -903,7 +903,7 @@ fwrite(&i, sizeof(int), 1, position_file); } else { printf("unable to open position learning file [%s/position.bin].\n", - book_path); + learn_path); return; } } diff -ru crafty-orig/main.c crafty/main.c --- crafty-orig/main.c Sat Feb 21 19:53:51 2004 +++ crafty/main.c Sun Mar 21 01:08:54 2004 @@ -3052,6 +3052,9 @@ quit = 0; if (directory_spec) strncpy(book_path, directory_spec, sizeof book_path); + directory_spec = getenv("CRAFTY_LEARN_PATH"); + if (directory_spec) + strncpy(learn_path, directory_spec, sizeof learn_path); directory_spec = getenv("CRAFTY_LOG_PATH"); if (directory_spec) strncpy(log_path, directory_spec, sizeof log_path); diff -ru crafty-orig/option.c crafty/option.c --- crafty-orig/option.c Sat Feb 21 19:53:51 2004 +++ crafty/option.c Sun Mar 21 01:10:06 2004 @@ -2810,6 +2810,8 @@ if (!strchr(args[1], '(')) { if (strstr(args[0], "bookpath")) strcpy(book_path, args[1]); + else if (strstr(args[0], "learnpath")) + strcpy(learn_path, args[1]); else if (strstr(args[0], "logpath")) strcpy(log_path, args[1]); else if (strstr(args[0], "tbpath")) {