From 95772c234f0afaf88ef01854868c93ff2e8a20fb Mon Sep 17 00:00:00 2001
From: H.G. Muller <h.g.muller@hccnet.nl>
Date: Tue, 13 Mar 2012 21:25:22 +0100
Subject: [PATCH] Install engines as ./exefile in XBoard

When a path name is split into directory and filename, the latter in Linux
must be preceded by ./ in order to make it executable in the directory
XBoard starts it in.
---
 backend.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/backend.c b/backend.c
index 5696701..b1d35a9 100644
--- a/backend.c
+++ b/backend.c
@@ -920,6 +920,7 @@ Load (ChessProgramState *cps, int i)
 	p[-1] = 0;
 	appData.directory[i] = strdup(engineName);
 	p[-1] = SLASH;
+	if(SLASH == '/' && p - engineName > 1) *(p -= 2) = '.'; // for XBoard use ./exeName as command after split!
     } else appData.directory[i] = ".";
     if(params[0]) {
 	if(strchr(p, ' ') && !strchr(p, '"')) snprintf(buf2, MSG_SIZ, "\"%s\"", p), p = buf2; // quote if it contains spaces
-- 
1.7.0.4