[Ecls-list] How do I determine if *standard-input* is coming from an interactive terminal
Juan Jose Garcia Ripoll
jlr at mpq.mpg.de
Thu Jun 30 10:30:34 UTC 2005
William Bland wrote:
>I'm using ECLS to write some command-line unix programs, and I need to
>determine if *standard-input* is coming from an interactive terminal,
>e.g. someone said:
>
>$ myprogram arg1 ... argn
>
>or if *standard-input* is being redirected from a pipe or a file, e.g.
>
>$ myprogram arg1 ... argn < file
>or
>$ otherprogram | myprogram arg1 ... argn
>
INTERACTIVE-STREAM-P should be enough (See below). The problem is that
the unix port was missing some code in the configuration to detect
whether the C function which implements this functionality (isatty())
exists. I am committing now a fix.
Juanjo
jlr at mpq3p32:~/src/ecls-new/build> ecl
ECL (Embeddable Common-Lisp) 0.9g
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help. Top level.
> (interactive-stream-p *standard-input*)
T
>
jlr at mpq3p32:~/src/ecls-new/build> echo '(interactive-stream-p
*standard-input*)' | ecl
ECL (Embeddable Common-Lisp) 0.9g
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help. Top level.
> NIL
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jlr.vcf
Type: text/x-vcard
Size: 389 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20050630/84f2ba39/attachment.vcf>
More information about the ecl-devel
mailing list