guile-user
[Top][All Lists]
Advanced

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

PATCH: assume -s


From: Aaron VanDevender
Subject: PATCH: assume -s
Date: Thu, 28 Aug 2003 09:32:29 -0400
User-agent: Mutt/1.2.5.1i

How would people feel about a patch like this? It makes guile
assume -s if its given an argument that doesn't match a known
flag. So you can say

guile foo.scm

instead of

guile -s foo.scm

The former is, of course, more in line with standard script
engines (bash, perl, etc...)


--- libguile.old/script.c       2003-08-28 08:13:55.000000000 -0500
+++ libguile/script.c   2003-08-28 08:26:02.000000000 -0500
@@ -595,9 +595,24 @@
 
       else
        {
-         fprintf (stderr, "%s: Unrecognized switch `%s'\n",
-                  scm_usage_name, argv[i]);
-         scm_shell_usage (1, 0);
+         /* If we specified the -ds option, do_script points to the
+            cdr of an expression like (load #f); we replace the car
+            (i.e., the #f) with the script name.  */
+         if (!SCM_NULLP (do_script))
+           {
+             SCM_SETCAR (do_script, scm_makfrom0str (argv[i]));
+             do_script = SCM_EOL;
+           }
+         else
+           /* Construct an application of LOAD to the script name.  */
+           tail = scm_cons (scm_cons2 (sym_load,
+                                       scm_makfrom0str (argv[i]),
+                                       SCM_EOL),
+                              tail);
+         argv0 = argv[i];
+         i++;
+         interactive = 0;
+         break;
        }
     }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]