$NetBSD: patch-ad,v 1.2 2004/02/14 04:31:56 kristerw Exp $

--- main.cpp.orig	2000-04-01 07:46:20.000000000 +0200
+++ main.cpp	2004-02-14 04:58:19.000000000 +0100
@@ -17,6 +17,7 @@
 #if UNIX
  #include <sys/types.h>
  #include <sys/time.h>
+ #include <unistd.h>
 #else
  #include <windows.h>
  #include <time.h>
@@ -56,7 +57,7 @@
 extern int ponder, last_ponder, learn_count, learned;
 extern unsigned long TAB_SIZE, PAWN_SIZE;
 
-// executable directory
+// exchess opening book and search parameters directory
 char exec_path[100];
 
 // performance function
@@ -93,16 +94,7 @@
   learn_count = 0; learned = 0; learn_bk = 1; shout_book = 0;
 
 
-   strcpy(exec_path, argv[0]);
-   // parsing exec path
-   int last_slash = 0;
-   for(int j = 0; j < 100; j++) {
-     if(exec_path[j] == '\0') break;
-     if(exec_path[j] == '\\') last_slash = j;
-     if(exec_path[j] == '/') last_slash = j;
-   }
-
-   exec_path[last_slash+1] = '\0';
+   strcpy(exec_path, EXCHESS_DIR);
 
  /* initializing hash tables, check tables, scoring parameters,
     and the random number seed and tablebases */
@@ -117,7 +109,7 @@
      if(li < 10) sprintf(lfile, "run_log.00%i", li);
      else if(li < 100) sprintf(lfile, "run_log.0%i", li);
      else sprintf(lfile, "run_log.%i", li);
-     logfile.open(lfile, ios::noreplace | ios::out);
+     logfile.open(lfile, ios::out);
      if(logfile) break;
     }
     if(!logfile) {
