thin-provisioning-tools/functional-tests/fmt/read-line.scm
Joe Thornber 3e5de399a7 [functional tests] Remove dependency on the ThunderChez library.
I've just moved the relevant code into the functional-tests dir.
2020-04-30 12:07:42 +01:00

12 lines
310 B
Scheme

(define (read-line . o)
(let ((port (if (pair? o) (car o) (current-input-port))))
(let lp ((res '()))
(let ((c (read-char port)))
(cond
[(and (eof-object? c) (null? res)) #f]
[(or (eof-object? c) (eqv? c #\newline))
(list->string (reverse res))]
[else
(lp (cons c res))])))))