#| -*-Scheme-*-
-$Id: ttyio.scm,v 1.18 2004/09/10 18:01:36 cph Exp $
+$Id: ttyio.scm,v 1.19 2004/10/06 13:48:51 cph Exp $
Copyright 1991,1993,1996,1999,2003,2004 Massachusetts Institute of Technology
(define console-input-port)
(define console-output-port)
\f
+(define *exit-on-eof?* #t)
+
(define (operation/read-char port)
(let ((char (generic-io/read-char port)))
(if (eof-object? char)
- (begin
- (if (not (nearest-cmdl/batch-mode?))
- (begin
- (fresh-line port)
- (write-string "End of input stream reached" port)))
- (%exit)))
- (maybe-echo-input port char)
+ (if *exit-on-eof?*
+ (begin
+ (if (not (nearest-cmdl/batch-mode?))
+ (begin
+ (fresh-line port)
+ (write-string "End of input stream reached." port)))
+ (%exit)))
+ (maybe-echo-input port char))
char))
(define (operation/read-finish port)
- (let loop ()
- (if (input-port/char-ready? port)
- (let ((char (generic-io/read-char port)))
- (if (not (eof-object? char))
- (if (char-whitespace? char)
- (begin
- (maybe-echo-input port char)
- (loop))
- (input-port/unread-char port char))))))
+ (fluid-let ((*exit-on-eof?* #f))
+ (let loop ()
+ (if (input-port/char-ready? port)
+ (let ((char (input-port/read-char port)))
+ (if (not (eof-object? char))
+ (if (char-whitespace? char)
+ (begin
+ (maybe-echo-input port char)
+ (loop))
+ (input-port/unread-char port char)))))))
(output-port/discretionary-flush port))
(define (maybe-echo-input port char)