This is the mail archive of the guile@sourceware.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]

Re: `expect-strings' and `with-input-from-port'



Apparently it's the (char-ready?) that makes B1 not work.  Seems that
it just returns #f all the time for the with-input-from-port version.
I have no idea why that happens, or what you should do if you really
need char-ready? in there.

. On Wed, Mar 22, 2000 at 09:57:46PM -0800, thi wrote:
...
> in the snippet appended below, (A) works, (B1) doesn't, but (B2) does.
> am i doing something wrong here?  (this is w/ recent cvs guile.)  can
> anyone get (B1) to work?
...
> ;;; A
> (with-input-from-port (open-input-pipe "cat /etc/passwd")
>   (lambda ()
>     (let loop ((c (read-char)))
>       (or (eof-object? c)
>           (begin
>             (display c)
>             (loop (read-char)))))))
> 
> ;;; B1
> (with-input-from-port (open-input-pipe "cat /etc/passwd")
> ;;; B2
> ;(with-input-from-file "/etc/passwd"
>   (lambda ()
>     (let loop ()
>       (and (char-ready?)
>            (begin
>              (expect-strings
>               ("^.+$"
>                => (lambda all
>                     (display all)
>                     (newline))))
>              (loop))))))
> 
> ;;;;;;;;;;; snippet ends here

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]