unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Re: -I for guile command line
@ 2004-07-05 17:56 Andy Wingo
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Wingo @ 2004-07-05 17:56 UTC (permalink / raw)


On Thu, 2004-07-01 at 20:35 -0500, Richard Todd wrote:
> any interest in this patch?  It lets you put -I on the guile command 
> line, to add directories to the load path.

I'm interested. I think that environment variable sucks, too.
(Especially given the recent discussion about "/foo/dir:" including the
current dir, in relation to hacking LD_LIBRARY_PATH and security
vulnerabilities.)

One thing: since guile scripts can chdir, perhaps the paths should be
resolved to absolute paths. But ++votes for it to be included in
guile :)

Cheers,
-- 
Andy Wingo <wingo@pobox.com>
http://ambient.2y.net/wingo/


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 9+ messages in thread
* -I for guile command line
@ 2004-07-02  1:35 Richard Todd
  2004-07-10  0:12 ` Kevin Ryde
  2004-08-15 21:27 ` Marius Vollmer
  0 siblings, 2 replies; 9+ messages in thread
From: Richard Todd @ 2004-07-02  1:35 UTC (permalink / raw)
  Cc: Richard Todd

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

any interest in this patch?  It lets you put -I on the guile command 
line, to add directories to the load path.

as in:
   guile -I ..  -I . script-in-development.scm

I find this easier than mucking with that environment variable.


[-- Attachment #2: dash_i.patch --]
[-- Type: application/octet-stream, Size: 1734 bytes --]

Index: libguile/script.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/script.c,v
retrieving revision 1.61
diff -u -r1.61 script.c
--- libguile/script.c	16 Jun 2004 04:08:25 -0000	1.61
+++ libguile/script.c	2 Jul 2004 01:29:05 -0000
@@ -361,6 +361,7 @@
            "remaining arguments as the value of (command-line).\n"
            "If FILE begins with `-' the -s switch is mandatory.\n"
            "\n"
+           "  -I DIRECTORY   add DIRECTORY to the module load path\n"
            "  -l FILE        load Scheme source code from FILE\n"
            "  -e FUNCTION    after reading script, apply FUNCTION to\n"
            "                 command line arguments\n"
@@ -395,7 +396,10 @@
 SCM_SYMBOL (sym_top_repl, "top-repl");
 SCM_SYMBOL (sym_quit, "quit");
 SCM_SYMBOL (sym_use_srfis, "use-srfis");
-
+SCM_SYMBOL (sym_load_path, "%load-path");
+SCM_SYMBOL (sym_set_x, "set!");
+SCM_SYMBOL (sym_cons, "cons");
+ 
 
 /* Given an array of command-line switches, return a Scheme expression
    to carry out the actions specified by the switches.
@@ -485,6 +489,18 @@
 	  break;
 	}
 
+      else if (! strcmp (argv[i], "-I"))
+        {
+         if (++i < argc)
+           tail = scm_cons (SCM_LIST3 (sym_set_x, sym_load_path,
+                                       SCM_LIST3 (sym_cons,
+                                                  scm_makfrom0str(argv[i]),
+                                                  sym_load_path)),
+                            tail);
+         else
+           scm_shell_usage (1, "missing argument to -I switch");
+         }
+      
       else if (! strcmp (argv[i], "-l")) /* load a file */
 	{
 	  if (++i < argc)

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

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

end of thread, other threads:[~2004-08-21 17:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-05 17:56 -I for guile command line Andy Wingo
  -- strict thread matches above, loose matches on Subject: below --
2004-07-02  1:35 Richard Todd
2004-07-10  0:12 ` Kevin Ryde
2004-07-10  1:28   ` Richard Todd
2004-08-15 21:27 ` Marius Vollmer
2004-08-15 21:36   ` Richard Todd
2004-08-15 23:17     ` Richard Todd
2004-08-15 23:18       ` Richard Todd
2004-08-21 17:45       ` Marius Vollmer

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).