shithub: femtolisp

Download patch

ref: c058c12afdb43db5a63a464dc6ba42e1050af0df
parent: d1a1d3b2a82b874b79d971a4c2456854068b026a
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Mar 9 16:28:15 EST 2023

take boot file from the same dir *.out is at

--- a/flisp.c
+++ b/flisp.c
@@ -2347,9 +2347,17 @@
     cvalues_init();
 
 #ifdef PLAN9
-    char *s;
-    if ((s = strstr(argv0, ".out")) == nil || s[4] != 0)
-        setc(symbol("*install-dir*"), cvalue_static_cstring("/sys/lib/flisp"));
+    char *s, *e;
+    if ((s = strstr(argv0, ".out")) != nil && s[4] == 0){
+        if((e = strrchr(argv0, '/')) != nil)
+            *e = 0;
+        s = strdup(argv0);
+        if(e != nil)
+            *e = '/';
+    }else{
+        s = "/sys/lib/flisp";
+    }
+    setc(symbol("*install-dir*"), cvalue_static_cstring(s));
 #else
     char buf[1024];
     char *exename = get_exename(buf, sizeof(buf));