Pull transcript handling from READ-LITERAL to new
authorChris Hanson <org/chris-hanson/cph>
Mon, 29 May 2000 04:35:29 +0000 (04:35 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 29 May 2000 04:35:29 +0000 (04:35 +0000)
READ-SUBSTRING!-INTERNAL.

v7/src/imail/imap-response.scm

index 7ac9719519791a7942fb46402fc1214a25792741..79dc6cf1b78c43662fd1f6e3ddbef04ce897aed1 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imap-response.scm,v 1.28 2000/05/28 15:29:22 cph Exp $
+;;; $Id: imap-response.scm,v 1.29 2000/05/29 04:35:29 cph Exp $
 ;;;
 ;;; Copyright (c) 2000 Massachusetts Institute of Technology
 ;;;
       (let loop ((start 0))
        (if (fix:< start n)
            (let ((m
-                  (read-substring! s
-                                   start
-                                   (fix:min (fix:+ start 4096) n)
-                                   port)))
+                  (read-substring!-internal s
+                                            start
+                                            (fix:min (fix:+ start 4096) n)
+                                            port)))
              (if (fix:= m 0)
                  (error "Premature EOF:" port))
              (let ((start (fix:+ start m)))
                         (fix:<= start n))
                    (*read-literal-progress-hook* start n))
                (loop start)))))
-      (if imap-transcript-port
-         (write-string s imap-transcript-port))
       (let ((n* (translate-line-endings!:network->scheme string 0 n)))
        (if (fix:< n* n)
            (set-string-maximum-length! s n*)))
        (write-string s imap-transcript-port))
     s))
 
+(define (read-substring!-internal string start end port)
+  (let ((n-read (read-substring! string start end port)))
+    (if imap-transcript-port
+       (write-substring string start (fix:+ start n-read)
+                        imap-transcript-port))
+    n-read))
+\f
 (define (start-imap-transcript pathname)
   (set! imap-transcript-port (open-output-file pathname))
   unspecific)