mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-11 23:17:34 +02:00
return null string on (read-string 0)
This commit is contained in:
parent
08554fd29c
commit
de539a472e
1 changed files with 11 additions and 9 deletions
|
@ -44,15 +44,17 @@
|
||||||
res))))))
|
res))))))
|
||||||
|
|
||||||
(define (read-string n . o)
|
(define (read-string n . o)
|
||||||
(let ((in (if (pair? o) (car o) (current-input-port))))
|
(if (zero? n)
|
||||||
(let ((res (%read-string n in)))
|
""
|
||||||
(cond
|
(let ((in (if (pair? o) (car o) (current-input-port))))
|
||||||
((if (pair? res) (= 0 (car res)) #t)
|
(let ((res (%read-string n in)))
|
||||||
eof)
|
(cond
|
||||||
(else
|
((if (pair? res) (= 0 (car res)) #t)
|
||||||
(port-line-set! in (+ (string-count #\newline (cadr res))
|
eof)
|
||||||
(port-line in)))
|
(else
|
||||||
(cadr res))))))
|
(port-line-set! in (+ (string-count #\newline (cadr res))
|
||||||
|
(port-line in)))
|
||||||
|
(cadr res)))))))
|
||||||
|
|
||||||
(define (read-string! str n . o)
|
(define (read-string! str n . o)
|
||||||
(let* ((in (if (pair? o) (car o) (current-input-port)))
|
(let* ((in (if (pair? o) (car o) (current-input-port)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue