$NetBSD: patch-ab,v 1.5 2000/12/27 00:24:43 dmcmahill Exp $

--- book.c.orig	Sat Oct 23 06:07:21 1999
+++ book.c	Tue Dec 26 19:07:35 2000
@@ -27,4 +27,5 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #ifdef NEVER
 #ifdef UNIX
@@ -86,5 +87,5 @@
   side = board.side;
   xside = 1^side;
-  rfp = fopen(BOOKBIN,"r+b");
+  rfp = fopen(BOOKBIN,"rb");	/* don't need to open read/write */
   if (rfp == NULL) {
     if (!(flags & XBOARD))
@@ -216,6 +217,11 @@
 }
 
-int genbook(void);
-int genbook()
+/*
+ * Change genbook() to accept source (pgn book) and target (bin book)
+ * paths.  This lets us generate a book from a pgn file different from
+ * the ones in BOOKSRC and BOOKBIN.
+ */
+int genbook(char *, char *);
+int genbook(char *src, char *tgt)
 {
   int i,j;
@@ -226,11 +232,11 @@
   FILE *wfp,*rfp;
 
-  printf("Trying to generate book %s from %s...\n",BOOKBIN,BOOKSRC);
-  if ((wfp = fopen(BOOKBIN,"w+b"))==NULL) {
-      printf("Couldn't open the bin book (%s) for write.\n",BOOKBIN);
+  printf("Trying to generate book %s from %s...\n",tgt,src);
+  if ((wfp = fopen(tgt,"w+b"))==NULL) {
+      printf("Couldn't open the bin book (%s) for write.\n",tgt);
       return(0);
   }
-  if ((rfp = fopen(BOOKSRC,"r"))==NULL) {
-	  printf("Couldn't open the pgn book (%s) for read.\n",BOOKSRC);
+  if ((rfp = fopen(src,"r"))==NULL) {
+	  printf("Couldn't open the pgn book (%s) for read.\n",src);
 	  fclose(wfp);
 	  return(0);
