From 25a89d045fc97f375610f3567af4207baf96a87c Mon Sep 17 00:00:00 2001
From: dos-reis <gdr@axiomatics.org>
Date: Sat, 13 Jun 2009 08:38:27 +0000
Subject: 	* driver/utils.c (openaxiom_execute_core): Workaround GCL
 oddity.

---
 src/ChangeLog      |  4 ++++
 src/driver/utils.c | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/ChangeLog b/src/ChangeLog
index 65ea5213..2607f13f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-13  Gabriel Dos Reis  <gdr@cs.tamu.edu>
+
+	* driver/utils.c (openaxiom_execute_core): Workaround GCL oddity.
+
 2009-06-12  Gabriel Dos Reis  <gdr@cs.tamu.edu>
 	
 	* interp/i-coerce.boot: Revert previous patch.
diff --git a/src/driver/utils.c b/src/driver/utils.c
index e817dcd4..1bf2eccc 100644
--- a/src/driver/utils.c
+++ b/src/driver/utils.c
@@ -373,12 +373,24 @@ openaxiom_execute_core(const openaxiom_command* command,
    int i;
    char** args = (char**)
       malloc(sizeof (char*) * (command->rt_argc + command->core_argc + 2));
-   args[0] = command->core_argv[0];
+   /* GCL has this oddity that it wants to believe that argv[0] has
+      something to tell about what GCL's own runtime is.  Silly.  */
+   if (OPENAXIOM_BASE_RTS == openaxiom_gcl_runtime)
+      args[0] = "";
+   else
+      args[0] = command->core_argv[0];
+   /* Now, make sure we copy whatever arguments are required by the
+      runtime system.  */
    for (i = 0; i < command->rt_argc; ++i)
       args[i + 1] = command->rt_argv[i];
+
    if (command->core_argc > 1) {
-      /* Insert a doubledash to indicate beginning of arguments.  */
+      /* We do have arguments from the command line.  We want to
+         differentiate this from the base runtime system arguments.
+         We do this by inserting a doubledash to indicate beginning
+         of arguments.  */
       args[command->rt_argc + 1] = "--";
+      /* Then, copy over the arguments received from the command line.  */
       for (i = 1; i < command->core_argc; ++i)
          args[command->rt_argc + i + 1] = command->core_argv[i];
       args[command->rt_argc + command->core_argc + 1] = NULL;
-- 
cgit v1.2.3