[fpc-pascal] EOF on stdin
XHajT03 at mbox.vol.cz
Sun Dec 9 21:14:37 CET 2007
On 8 Dec 07, at 13:20, Mark Morgan Lloyd wrote:
> Good grief- that was quick :-)
> Marco van de Voort wrote:
> >> I'm trying to distinguish between a case where there is no parameter on the
> >> command line and where there is piped input. The code below works under Win-32
> >> but under Linux Eof() waits for input:
> >> If I start it under linux by piping an eof (i.e. echo -n |) it works.
> >> I'm sure this is something that's been looked at before- how do I get it to work?
> > For unix one can simply use termio.isatty(input) I think.
> Thanks, I'll investigate. I was going to look at that but you've saved me a
> /lot/ of work identifying the correct function name :-)
Note that you could use function Do_IsDevice
provided in system unit for this (if Input is
redirected/piped, it is not a device, otherwise
it uses the console device). However, I suspect
that this function is only used internally and
there's no way of directly accessing it outside
the System unit. Nevertheless, you should be able
to find proper implementation for all FPC
supported platforms by looking at implementation
of this function.
More information about the fpc-pascal