lilypond-1.5.22
authorfred <fred>
Wed, 27 Mar 2002 02:04:11 +0000 (02:04 +0000)
committerfred <fred>
Wed, 27 Mar 2002 02:04:11 +0000 (02:04 +0000)
lily/include/lily-guile.hh
lily/main.cc

index e2a74c779f17a1c2b2835c7b5ab3d9914a590558..2fb4f54cb32a6b96a61d733a71d8e8624e45f726 100644 (file)
@@ -164,7 +164,7 @@ void ly_display_scm (SCM s);
 #include "array.hh"
 
 void read_lily_scm_file (String);
-void init_lily_guile ();
+void init_lily_guile (String dir);
 
 bool isdir_b (SCM s);
 bool isaxis_b (SCM s);
index f4ccf040d06930c9b2256d7d6efcf32646cfe291..39e462d9445f649d47e7c5a2927e84304169da3b 100644 (file)
@@ -34,6 +34,7 @@
 #include "global-ctor.hh"
 #include "kpath.hh"
 
+static int sane_putenv (char const* key, char const* value, bool overwrite = false);
 
 /*
   Global options that can be overridden through command line.
@@ -269,21 +270,6 @@ setup_paths ()
        i++;
 #endif
     }
-
-  char const * glp = getenv ("GUILE_LOAD_PATH");
-  
-  String new_glp (glp? glp : "") ;
-  if (glp)
-    new_glp = ":" + new_glp;
-  new_glp = prefix_directory + new_glp;
-
-  /*
-    Yes , so setenv is not posix.
-
-    I say, fuckem'all.
-   */
-
-  setenv ("GUILE_LOAD_PATH", new_glp.ch_C(), 1);
 }
 
 /**
@@ -332,7 +318,13 @@ main_prog (void * , int, char**)
   /*
     need to do this first. Engravers use lily.scm contents.
    */
-  init_lily_guile ();
+  
+  /*
+    prepend onto GUILE  loadpath.
+
+    Very ugh.
+   */
+  init_lily_guile (prefix_directory);
   cout << endl;
 
   call_constructors ();
@@ -403,14 +395,11 @@ main_prog (void * , int, char**)
   exit (exit_status_global);
 }
 
+
 static int
-sane_putenv (char const* key, char const* value)
+sane_putenv (char const* key, char const* value, bool overwrite)
 {
-  /*
-    putenv is POSIX, setenv is BSD 4.3
-    Urg, but putenv blindly overwrites environment settings.
-  */
-  if (!getenv (key))
+  if (overwrite || !getenv (key))
     return putenv ((char*)((String (key) + "=" + value).ch_C ()));
   return -1;
 }
@@ -431,8 +420,8 @@ main (int argc, char **argv)
      execution time penalty (~*1.10).  However, if this 15% gain in memory
      usage prevents swapping, the execution time falls drastically. */
   
-  sane_putenv ("GUILE_INIT_SEGMENT_SIZE_1", "4194304");
-  sane_putenv ("GUILE_MAX_SEGMENT_SIZE", "8388608");
+  sane_putenv ("GUILE_INIT_SEGMENT_SIZE_1", "4194304", false);
+  sane_putenv ("GUILE_MAX_SEGMENT_SIZE", "8388608", false);
 
   ly_init_kpath (argv[0]);