This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Some time ago i noticed a small bug in guile: It didn't read anything on a (read-line). This got fixed lately in a CVS release. But a few minutes ago i was experimenting and found a similar bug (if not the same): (read-line (car (fdes->ports 0))) should get whatever you type as a string, just like (read-line) does. However: guile> (read-line (car (fdes->ports 0))) hello "" I've written a simple replacement for (read-line) some time ago, and with it, this works: guile> (load "own-readline.scm") guile> (read-line (car (fdes->ports 0))) hello "hello" (define (read-line . port) (let rl-loop ((string "")) (let ((next (if (null? port) (read-char) (read-char (car port))))) (cond ((eqv? next #\newline) string) ((eof-object? next) next) (#t (rl-loop (string-append string (make-string 1 next)))))))) (i'm fairly new to Scheme, don't kill me for this piece of code) I hope this helps, -forcer -- /* A CONS is an object which cares. */ /* email: forcer@mindless.com -><- www: http://webserver.de/forcer/ */ /* IRC: forcer@#StarWars (IRCnet) -><- PGP/GPG: available on my website */