rewrite POP3-DUMP to something legible
This commit is contained in:
sperber 2003-01-20 15:02:22 +00:00
parent 321bb04603
commit 3ef18b6abf
2 changed files with 11 additions and 10 deletions

View File

@ -261,14 +261,15 @@
(pop3-handle-response (pop3-read-response connection) command))) (pop3-handle-response (pop3-read-response connection) command)))
(define (pop3-dump fd) (define (pop3-dump fd)
(let loop ((line (read-crlf-line fd))) (let loop ()
(cond ((and (not (eof-object? line)) (let ((line (read-crlf-line fd)))
(not (equal? line ".\r"))) (if (and (not (eof-object? line))
(and (eq? 0 (string-index line #\.)) ; fix byte-stuffed lines (not (string=? line ".")))
(eq? 1 (string-index line #\. 1)) (let ((line (if (string-prefix? ".." line)
(set! line (substring line 1 (string-length line)))) (substring line 1 (string-length line))
(write-string line) line)))
(newline) (write-string line)
(loop (read-crlf-line fd)))))) (newline)
(loop))))))
;; EOF ;; EOF

View File

@ -449,7 +449,7 @@
handle handle
conditions handle-fatal-error conditions handle-fatal-error
signals signals
(subset srfi-13 (string-index)) (subset srfi-13 (string-index string-prefix?))
let-opt let-opt
crlf-io) crlf-io)
(files (lib pop3))) (files (lib pop3)))