-(define (drain-input port)
- (list->string
- (let loop ((c (read-char)))
- (if (eq? c #\*eof*) '()
- (cons c (loop (read-char)))))))
+(define (read-string)
+ (define (read-string c)
+ (if (eq? c #\*eof*) '()
+ (cons c (read-string (read-char)))))
+ (let ((string (list->string (read-string (read-char)))))
+ (if (getenv "MES_DEBUG")
+ (core:display-error (string-append "drained: `" string "'\n")))
+ string))
+
+(define (drain-input port) (read-string))