[gcompris/gcomprixogoo] Support GNUCHESS environment variable



commit 6a6d0de08703a08ba3121c862040d66c90e2c498
Author: Aleksey Lim <alsroot member fsf org>
Date:   Wed May 26 05:40:54 2010 +0000

    Support GNUCHESS environment variable
    
    Will be useful in 0install environment when GnuChess is installed from 0install feed.

 src/chess_computer-activity/chess.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/chess_computer-activity/chess.c b/src/chess_computer-activity/chess.c
index 4c2dcb4..4ff4be0 100644
--- a/src/chess_computer-activity/chess.c
+++ b/src/chess_computer-activity/chess.c
@@ -229,12 +229,15 @@ static void start_board (GcomprisBoard *agcomprisBoard)
 {
 
   gchar **gnuchess_pathptr = gnuchess_path;
-  gchar *gnuchess_bin = NULL;
+  gchar *gnuchess_bin = g_strdup(getenv("GNUCHESS"));
 
 
   do
     {
-      if(*gnuchess_pathptr[0] == '/')
+      if(gnuchess_bin != NULL)
+	{
+	}
+      else if(*gnuchess_pathptr[0] == '/')
 	{
 	  gnuchess_bin = strdup(*gnuchess_pathptr);
 	}
@@ -251,6 +254,7 @@ static void start_board (GcomprisBoard *agcomprisBoard)
 
       gnuchess_pathptr++;
       g_free(gnuchess_bin);
+      gnuchess_bin = NULL;
     } while(*gnuchess_pathptr != NULL);
 
   if(*gnuchess_pathptr == NULL)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]