From dac9812a2e02c680693ee6dfeb1a96f2b45151cb Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 28 Apr 2011 21:43:01 +0200 Subject: [PATCH] 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. --- module/ice-9/command-line.scm | 26 ++++++++++++++------------ 1 file 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"))