
Author: mhenoch Date: Sat Mar 10 22:10:57 2007 New Revision: 107 Modified: cl-darcs/trunk/util.lisp Log: Fix EOF handling of READ-BINARY-LINE Modified: cl-darcs/trunk/util.lisp ============================================================================== --- cl-darcs/trunk/util.lisp (original) +++ cl-darcs/trunk/util.lisp Sat Mar 10 22:10:57 2007 @@ -96,10 +96,15 @@ Return a vector of binary values. Return EOF-VALUE if EOF-ERROR-P is nil and end-of-file occurs before any data is read." (multiple-value-bind (line delim) - (read-until 10 stream eof-error-p eof-value) - (if (or (not (zerop (length line))) (eql delim 10)) - line - delim))) + (read-until 10 stream nil :eof) + (cond + ;; nothing read, and we've reached the end + ((and (zerop (length line)) (eq delim :eof)) + (if eof-error-p + (error 'end-of-file :stream stream) + eof-value)) + (t + line)))) (defun read-token (stream) "Read and return a whitespace-separated token from STREAM.
participants (1)
-
mhenoch@common-lisp.net