From: Chris Hanson Date: Wed, 6 Oct 2004 13:48:51 +0000 (+0000) Subject: Fix think-o in READ-FINISH that caused infinite loop when reading an X-Git-Tag: 20090517-FFI~1569 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=1ddf14c9f6674c0a96c0da1b6df452736672828d;p=mit-scheme.git Fix think-o in READ-FINISH that caused infinite loop when reading an atom. --- diff --git a/v7/src/runtime/ttyio.scm b/v7/src/runtime/ttyio.scm index 2946c9a92..c05886301 100644 --- a/v7/src/runtime/ttyio.scm +++ b/v7/src/runtime/ttyio.scm @@ -1,6 +1,6 @@ #| -*-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 @@ -96,28 +96,32 @@ USA. (define console-input-port) (define console-output-port) +(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)