summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-04-28 21:43:01 +0200
committerAndy Wingo <wingo@pobox.com>2011-04-28 21:43:01 +0200
commitdac9812a2e02c680693ee6dfeb1a96f2b45151cb (patch)
tree74a9e720dca0cc4da276ea8ebd3ff0b3b6f94b14
parent800690141ff7ce91014bfc1134a9bb0e358ce38f (diff)
downloadguile-dac9812a2e02c680693ee6dfeb1a96f2b45151cb.tar.gz
fix double-loading of script in -ds case
* module/ice-9/command-line.scm (compile-shell-switches): In the -ds case, we were erroneously loading the script twice. Fix that.
-rw-r--r--module/ice-9/command-line.scm26
1 files changed, 14 insertions, 12 deletions
diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm
index a34c9a67c..670382fb9 100644
--- a/module/ice-9/command-line.scm
+++ b/module/ice-9/command-line.scm
@@ -197,26 +197,28 @@ If FILE begins with `-' the -s switch is mandatory.
(args (cdr args)))
(cond
((not (string-prefix? "-" arg)) ; foo
- ;; 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 (pair? do-script)
- (set-car! do-script arg))
+ ;; If we specified the -ds option, do-script is the cdr of
+ ;; an expression like (load #f). We replace the car (i.e.,
+ ;; the #f) with the script name.
(set! arg0 arg)
(set! interactive? #f)
- (finish args
- (cons `(load ,arg) out)))
+ (if (pair? do-script)
+ (begin
+ (set-car! do-script arg0)
+ (finish args out))
+ (finish args (cons `(load ,arg0) out))))
((string=? arg "-s") ; foo
(if (null? args)
(error "missing argument to `-s' switch"))
(set! arg0 (car args))
- (if (pair? do-script)
- (set-car! do-script arg0))
(set! interactive? #f)
- (finish (cdr args)
- (cons `(load ,arg0) out)))
-
+ (if (pair? do-script)
+ (begin
+ (set-car! do-script arg0)
+ (finish (cdr args) out))
+ (finish (cdr args) (cons `(load ,arg0) out))))
+
((string=? arg "-c") ; evaluate expr
(if (null? args)
(error "missing argument to `-c' switch"))