unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* PATCH: assume -s
@ 2003-08-28 13:32 Aaron VanDevender
  2003-08-29 10:38 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 18+ messages in thread
From: Aaron VanDevender @ 2003-08-28 13:32 UTC (permalink / raw)
  Cc: guile-sources

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
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2003-09-10 16:51 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-28 13:32 PATCH: assume -s Aaron VanDevender
2003-08-29 10:38 ` Thien-Thi Nguyen
2003-08-29 13:20   ` Aaron VanDevender
2003-08-29 15:41     ` Thien-Thi Nguyen
2003-08-31 18:23       ` Marius Vollmer
2003-09-01  9:24         ` Thien-Thi Nguyen
2003-08-30 19:40     ` Neil Jerram
2003-08-30 20:00       ` Neil Jerram
2003-08-31 18:16         ` Marius Vollmer
2003-08-31 22:56           ` Neil Jerram
2003-09-03  1:54       ` Kevin Ryde
2003-09-03 23:17         ` Neil Jerram
2003-09-04  0:05           ` Kevin Ryde
2003-09-04 16:02             ` Paul Jarc
2003-09-05 18:22               ` Robert Uhl
2003-09-09 22:58               ` Kevin Ryde
2003-09-10 16:51                 ` Paul Jarc
2003-09-04 18:56             ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).