Changed the -s- option to the -s<num> option.

This commit is contained in:
shivers 1996-08-30 08:36:34 +00:00
parent 46aa9a9424
commit 9610aeab66
3 changed files with 23 additions and 11 deletions

View File

@ -622,7 +622,7 @@ scsh [meta-arg] [switch1 ...] [end-option arg1 ...]
-ds Do script.
end-option: -s <script> Specifies script to load.
-s- Script from standard input.
-s<num> Script from file descriptor <num>.
-c <expression> Eval <expression> and exit.
--

View File

@ -266,7 +266,7 @@
receiving
scsh-version
scsh-level-0 ; with-current-input-port error-output-port
; with-current-output-port exit
; with-current-output-port exit regexp
scsh-level-0-internals ; set-command-line-args! init-scsh-vars
scheme)
(files top meta-arg))

View File

@ -45,7 +45,7 @@
;;; Terminating switches:
;;; -c <exp> Eval <exp>, then exit.
;;; -s <script> Specify <script> to be loaded by a -ds or -dm.
;;; -s- Script is standard input.
;;; -s<num> Script is on file descriptor <num>.
;;; -- Interactive scsh.
@ -54,10 +54,10 @@
;;; - We first expand out any initial \ <filename> meta-arg.
;;; - A switch-list elt is either "-ds", "-dm", or a (switch . arg) pair
;;; for a -o, -n, -m, -l, or -lm switch.
;;; - Terminating switch is one of {s, c, #f} for -s or -s-, -c,
;;; - Terminating switch is one of {s, c, #f} for -s or -s<num>, -c,
;;; and -- respectively.
;;; - Terminating arg is the <exp> arg to -c, the <script> arg to -s,
;;; the standard input port for -s-, otw #f.
;;; the input port for -s<num>, otw #f.
;;; - top-entry is the <entry> arg to a -e; #f if none.
;;; - command-line args are what's left over after picking off the scsh
;;; switches.
@ -83,9 +83,16 @@
(values (reverse switches) 's (car args)
top-entry (cdr args))))
((string=? arg "-s-")
(values (reverse switches) 's (current-input-port)
top-entry args))
;; -s<num>
((regexp-exec fd-script-regexp arg) =>
(lambda (m)
(let* ((fd (string->number (match:substring m 1) 10))
(p (fdes->inport fd)))
(release-port-handle p) ; Unreveal the port.
(values (reverse switches)
's
(fdes->inport fd)
top-entry args))))
((string=? arg "--")
(if need-script?
@ -128,6 +135,7 @@
(values (reverse switches) #f #f top-entry '()))))
(define fd-script-regexp (make-regexp "^-s([0-9]+)$"))
;;; Do each -ds, -dm, -o, -n, -m, -l, and -lm switch, and return the final
;;; result package and a flag saying if the script was loaded by a -ds or -dm.
@ -219,14 +227,18 @@
;; Have to do these before calling DO-SWITCHES, because actions
;; performed while processing the switches may use these guys.
(set-command-line-args!
(cons (if (eq? term-switch 's) term-val "scsh")
(cons (if (eq? term-switch 's)
(if (string? term-val)
term-val ; Script file.
"file-descriptor-script"); -s<num>
"scsh")
args))
;; Set HOME-DIRECTORY and EXEC-PATH-LIST,
;; quietly if not running an interactive script.
(init-scsh-vars term-switch)
(let ((script-loaded? (do-switches switches term-val)))
(let* ((script-loaded? (do-switches switches term-val)))
(if (and (not script-loaded?) ; There wasn't a -ds or -dm,
(eq? term-switch 's)) ; but there is a script,
(load-quietly term-val ; so load it now.
@ -288,7 +300,7 @@ switch: -e <entry-point> Specify top-level entry point.
-dm Do script module.
end-option: -s <script> Specify script.
-s- Script is standard input.
-s<num> Script is on file descriptor <num>.
-c <exp> Evaluate expression.
-- Interactive session.
"))