--- glulxe/unixstrt.c.orig	Sun Jul  1 15:25:55 2001
+++ glulxe/unixstrt.c	Sun Jul  1 19:14:17 2001
@@ -7,6 +7,8 @@
 #include "glulxe.h"
 #include "glkstart.h" /* This comes with the Glk library. */
 
+#define FILENAME_MAX 1024
+
 /* The only command-line argument is the filename. */
 glkunix_argumentlist_t glkunix_arguments[] = {
   { "", glkunix_arg_ValueFollows, "filename: The game file to load." },
@@ -29,9 +31,29 @@
     
   gamefile = glkunix_stream_open_pathname(cx, FALSE, 1);
   if (!gamefile) {
-    init_err = "The game file could not be opened.";
-    init_err2 = cx;
-    return TRUE;
+    /* not loaded, let's try the search path in GLULX_PATH */
+    char *searchpath;
+
+    searchpath = getenv( "GLULX_PATH" );
+    if ( searchpath && (strlen(searchpath) > 0) )
+    {
+      char *p;
+      p = strtok( searchpath, ":" );
+      while ( p && !gamefile )
+      {
+        char searchfile[FILENAME_MAX+1];
+        sprintf( searchfile, "%s/%s", p, cx);
+        gamefile = glkunix_stream_open_pathname(searchfile, FALSE, 1);
+        p = strtok( searchpath, ":" );
+      }
+
+      if ( !gamefile )
+      {
+        init_err = "The game file could not be opened.";
+        init_err2 = cx;
+        return TRUE;
+      }
+    }
   }
 
   /* Now we have to check to see if it's a Blorb file. */
