PATCH: assume -s

Aaron VanDevender <[email protected]>
Newsgroups gmane.lisp.guile.user,gmane.lisp.guile.sources
Message-ID <[email protected]>
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;
 	}
     }
 


_______________________________________________
Guile-user mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/guile-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.