forked from alex-eg/sex
refuse a second input file
It was never read, and nothing said so.
This commit is contained in:
15
sexc.scm
15
sexc.scm
@@ -146,11 +146,14 @@
|
||||
(map string->symbol (string-split (cdr entry) ",")))
|
||||
(filter (lambda (entry) (eq? (car entry) 'features)) args)))
|
||||
|
||||
(define (get-input-file args)
|
||||
(let ((rest-args (get-rest-args args)))
|
||||
(if (null? rest-args)
|
||||
'stdin
|
||||
(car rest-args))))
|
||||
(define (get-input-file args dash?)
|
||||
(let ((inputs (append (if dash? (list "-") (list)) (get-rest-args args))))
|
||||
(cond ((null? inputs) 'stdin)
|
||||
;; any after the first were never read, and nothing said so
|
||||
((pair? (cdr inputs))
|
||||
(apply error "sexc compiles one input file at a time; given" inputs))
|
||||
(dash? 'stdin)
|
||||
(else (car inputs)))))
|
||||
|
||||
(define (stdout-output? output)
|
||||
(or (eq? output 'default) (equal? output "-")))
|
||||
@@ -266,7 +269,7 @@ status, which is ours to pass on."
|
||||
(output (get-arg args 'output 'default))
|
||||
(help (help-arg? args))
|
||||
|
||||
(input (if (stdin-dash? raw-args) 'stdin (get-input-file args)))
|
||||
(input (get-input-file args (stdin-dash? raw-args)))
|
||||
(current-dir (current-directory)))
|
||||
(call/cc
|
||||
(lambda (return)
|
||||
|
||||
Reference in New Issue
Block a user