[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
27 Aug 2001 10:24:21 +0100
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7
>>>>> "Gary" == Gary Houston <address@hidden> writes:
>> From: Alex Shinn <address@hidden> Date: 24 Aug 2001
>> 11:11:05 -0400
>> Could someone explain the purpose of drain-input? My first
>> impression was that it would read all remaining input from an
>> input port, so that you could do the following:
Gary> It's returning the contents of the port input buffers. It's
Gary> possibly useful for syncing buffered input for operations
Gary> that act directly on the file descriptor.
Here's a procedure that does what I expected `drain-input' to be. I
use it often in connection with `open-input-pipe':
(define (drain-output port)
(let loop ((chars '())
(next (read-char port)))
(if (eof-object? next)
(list->string (reverse! chars))
(loop (cons next chars)
(define (texinfo->info str)
(let* ((tmp (mkstemp! (string-copy "/tmp/guile-makeinfo-XXXXXX")))
(tmpfn (port-filename tmp)))
(display str tmp)
(let* ((pipe (open-input-pipe (string-append "makeinfo"
" -o - "
(infostr (drain-output pipe)))
Perhaps it would be worth adding `drain-output' to (ice-9 popen) ?