-s<num> is now -sfd <num> -- more consistent with general switch design.

This commit is contained in:
shivers 1996-11-11 19:21:25 +00:00
parent 47c2eea2dd
commit 2f7c39be3f
4 changed files with 19 additions and 20 deletions

2
NEWS
View File

@ -13,6 +13,8 @@ Recent changes to the Scheme Shell.
Name-consistency change (non-backwards compatible):
open/nonblocking renamed to open/non-blocking,
which is the way it was always described in the manual.
-s<num> is now -sfd <num> -- more consistent with general switch
design.
11/03/96 (version 0.4.4)
minor fixes for SunOS, Solaris, AIX, NeXTStep, 686 systems

View File

@ -160,7 +160,7 @@ We even have one of those URL things:
** New meta-arg second-line syntax
Simpler grammar.
** New -s<fdes> command line switch
** New -sfd <fdes> command line switch
Scripts can be read from stdin or other open file descriptors.
** Starting up programs with the "-e <entry-point>" command-line

View File

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

View File

@ -36,7 +36,7 @@
;;; -l <file> Load <file> into current package.
;;; -lm <file> Load <file> into config package.
;;;
;;; These two require terminating -s <script> arg:
;;; These two require a terminating -s or -sfd arg:
;;; -ds Load terminating script into current package.
;;; -dm Load terminating script into config package.
;;;
@ -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<num> Script is on file descriptor <num>.
;;; -sfd <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<num>, -c,
;;; - Terminating switch is one of {s, c, #f} for -s or -sfd, -c,
;;; and -- respectively.
;;; - Terminating arg is the <exp> arg to -c, the <script> arg to -s,
;;; the input port for -s<num>, otw #f.
;;; the input port for -sfd, 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,16 +83,15 @@
(values (reverse switches) 's (car args)
top-entry (cdr 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))))
;; -sfd <num>
((string=? arg "-sfd")
(if (not (pair? args))
(bad-arg "-sfd switch requires argument")
(let* ((fd (string->number (car args)))
(p (fdes->inport fd)))
(release-port-handle p) ; Unreveal the port.
(values (reverse switches) 's p
top-entry (cdr args)))))
((string=? arg "--")
(if need-script?
@ -135,8 +134,6 @@
(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.
@ -230,7 +227,7 @@
(cons (if (eq? term-switch 's)
(if (string? term-val)
term-val ; Script file.
"file-descriptor-script"); -s<num>
"file-descriptor-script"); -sfd <num>
(car all-args))
args))
@ -300,7 +297,7 @@ switch: -e <entry-point> Specify top-level entry point.
-dm Do script module.
end-option: -s <script> Specify script.
-s<num> Script is on file descriptor <num>.
-sfd <num> Script is on file descriptor <num>.
-c <exp> Evaluate expression.
-- Interactive session.
"))