> 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 ParamCount = 0 THEN BEGIN (* Case (1) or (2) *) > debug('No parameters (case 1 or 2)'); > TRY > AssignFile(input, ''); (* Standard input *) > {$IOCHECKS OFF } > Reset(input); // Returns zero > TRY > IF Eof(input) THEN BEGIN (* Case (1) *) > debug('At EOF (case 1)'); > {$IOCHECKS ON } > > // Nothing on command line. > > END ELSE BEGIN (* Case (2) *) > debug('Not at EOF (case 2)'); > > // Got piped 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. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal