diff --git a/scsh/startup.scm b/scsh/startup.scm index 947f71f..ac8b2d7 100644 --- a/scsh/startup.scm +++ b/scsh/startup.scm @@ -50,15 +50,15 @@ (define (scsh-stand-alone-resumer start) (usual-resumer ;sets up exceptions, interrupts, and current input & output - (lambda (args) + (lambda (args) ; VM gives us our args, but not our program. (init-scsh-hindbrain #t) ; Whatever. Relink & install scsh's I/O system. (call-with-current-continuation (lambda (halt) - (set! %full-command-line args) - (set-command-line-args! (cons "" args)) ; WRONG. + (set! %vm-prog-args (cons "scsh" args)) ; WRONG -- use image. + (set-command-line-args! %vm-prog-args) (with-handler (simple-condition-handler halt (error-output-port)) (lambda () - (let ((exit-val (start command-line-arguments))) + (let ((exit-val (start (command-line)))) (if (integer? exit-val) exit-val 0))))))))) ; work around bug. -(define %full-command-line #f) +(define %vm-prog-args #f) diff --git a/scsh/syscalls.scm b/scsh/syscalls.scm index 5bb8c8f..c664e05 100644 --- a/scsh/syscalls.scm +++ b/scsh/syscalls.scm @@ -1072,11 +1072,11 @@ (define-errno-syscall (%fcntl-read fd command) %fcntl-read/errno value) (define-errno-syscall (%fcntl-write fd command val) %fcntl-write/errno) -;;; fcntl()'s F_GETFD and F_SETFD. -;;; Note that the SLEAZY- prefix on the CALL/FDES isn't an optimisation. -;;; Straight CALL/FDES modifies unrevealed file descriptors by clearing -;;; their CLOEXEC bit when it reveals them -- so it would interfere with -;;; the reading. +;;; fcntl()'s F_GETFD and F_SETFD. Note that the SLEAZY- prefix on the +;;; CALL/FDES isn't an optimisation; it's *required* for the correct behaviour +;;; of these procedures. Straight CALL/FDES modifies unrevealed file +;;; descriptors by clearing their CLOEXEC bit when it reveals them -- so it +;;; would interfere with the reading and writing of that bit! (define (fdes-flags fd/port) (sleazy-call/fdes fd/port diff --git a/scsh/top.scm b/scsh/top.scm index 42ce408..cfc235b 100644 --- a/scsh/top.scm +++ b/scsh/top.scm @@ -214,9 +214,9 @@ name)) -(define (parse-switches-and-execute args context) +(define (parse-switches-and-execute all-args context) (receive (switches term-switch term-val top-entry args) - (parse-scsh-args args) + (parse-scsh-args (cdr all-args)) ((with-new-session context ; "Log in" user. (current-input-port) (current-output-port) args @@ -231,7 +231,7 @@ (if (string? term-val) term-val ; Script file. "file-descriptor-script"); -s - "scsh") + (car all-args)) args)) ;; Set HOME-DIRECTORY and EXEC-PATH-LIST,