[Ecls-list] ecl_stream_to_handle bug? (Was: Latest changes)

Dave Roberts dave at vyatta.com
Wed Nov 1 18:38:57 UTC 2006

Juan Jose Garcia-Ripoll wrote:
> 2006/11/1, Dave Roberts <dave at vyatta.com>:
>> Juan Jose Garcia-Ripoll wrote:
>> > Well, the thing is that this routine does not know how to deal with
>> > sockets and sllime does communicate via sockets with ECL.
>> I'm not sure exactly how Slime does its thing, but sockets still have
>> file handles, no? That is, at least under Unix-like systems, I would not
>> expect this routine to return -1 unless the particular stream was closed.
> SB-SOCKETS in ECL are implemented as CLOS objects. The routine you try
> to use does not know about these objects. Indeed, this routine was not
> at all expected to be exported. It is so level it was thought for
> internal use in the core library. I made it public because I was asked
> to do so. Now it does not fit your work, well, extend it! :-)

Okay, okay, I'll quit whining and get coding... ;-)

> In your case you probably do not even need do it. Your function must
> check first whether the input/output stream is a CLOS object and
> return NIL in that case because isatty() does not make a sense on Gray
> streams.

Actually, I'd pass the file handle to isatty. Something like:

(if (isatty (ecl_stream_to_handle *standard-input*))
     ...set terminal for raw IO...
     ...else just use readline...)

-- Dave

More information about the ecl-devel mailing list