Mail Archives: djgpp-workers/2003/03/07/19:27:37
Hello.
DJ Delorie wrote:
[snip]
> > + /* Is this a redirected standard handle: stdout, stderr?
> > + * I.e.: are the standard handles pipes? Disallow on pipes. */
> > + switch(fd) {
> > + case STDOUT_FILENO:
> > + case STDERR_FILENO:
> > + if (isatty(fd) == 0) {
>
> Why not just call isatty() for all fds? stderr/stdout aren't the only
> fds that can be redirected. Consider that at least stdaux and stdprn
> are also ttys.
[snip]
But is there any easy way we can distinguish between pipes and (regular files,
character devices)? With stdin, stdout, stderr we can assume they are pipes,
if they are not TTYs. But we can't assume that for other file descriptors - we
can use fd_props, if available, to find out. Hence the code only checks stdout
& stderr using isatty().
BTW stdaux and stdprn are not TTYs according to isatty(). Is this a bug?
Bye, Rich =]
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -