From 3cd40c8f9899e524b8174b025b46e3c489d45fd9 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Thu, 22 Feb 1990 12:40:57 +0000
Subject: [PATCH] .../systems-work/code/stream.lisp, 16-Jan-90 11:47:26, Edit
 by Wlott.   Fixed bug in read-n-bytes: buffer was used where in-buffer should
 have been.

.../systems-work/code/stream.lisp, 23-Oct-89 16:45:49, Edit by Chiles.
  Picked up Chris's fix to make CLEAR-INPUT always return nil.

/usr1/lisp/ncode/stream.lisp, 25-Aug-89 11:46:56, Edit by Chiles.
  Added FILE-POSITION methods for string streams.
---
 code/stream.lisp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/code/stream.lisp b/code/stream.lisp
index c340d64d3..438aa6ee0 100644
--- a/code/stream.lisp
+++ b/code/stream.lisp
@@ -14,7 +14,7 @@
 ;;; file (VAXIO, SPIO, or VMIO) contains functions used by this file for
 ;;; a specific machine.
 ;;;
-(in-package 'lisp)
+(in-package "LISP")
 
 (export '(make-broadcast-stream make-synonym-stream
 	  make-broadcast-stream make-concatenated-stream make-two-way-stream
@@ -278,7 +278,8 @@
   "Clears any buffered input associated with the Stream."
   (let ((stream (in-synonym-of stream)))
     (setf (stream-in-index stream) in-buffer-length)
-    (funcall (stream-misc stream) stream :clear-input)))
+    (funcall (stream-misc stream) stream :clear-input)
+    nil))
 
 (defun read-byte (stream &optional (eof-errorp t) eof-value)
   "Returns the next byte of the Stream."
@@ -301,7 +302,7 @@
 	 (num-buffered (- in-buffer-length index)))
     (declare (fixnum index num-buffered))
     (cond
-     ((not buffer)
+     ((not in-buffer)
       (with-in-stream stream stream-n-bin buffer start numbytes eof-errorp))
      ((not (eql (%primitive get-vector-access-code in-buffer) 3))
       (error "N-Bin only works on 8-bit-like streams."))
@@ -762,6 +763,9 @@
 
 (defun string-in-misc (stream operation &optional arg1 arg2)
   (case operation
+    (:file-position
+     (if (null arg1)
+       (string-input-stream-current stream)))
     (:read-line
      (let ((string (string-input-stream-string stream))
 	   (current (string-input-stream-current stream))
@@ -849,6 +853,9 @@
 (defun string-out-misc (stream operation &optional arg1 arg2)
   (declare (ignore arg1 arg2))
   (case operation
+    (:file-position
+     (if (null arg1)
+       (string-output-stream-index stream)))
     (:charpos
      (do ((index (1- (the fixnum (string-output-stream-index stream)))
 		 (1- index))
-- 
GitLab