delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/03/07/20:11:45

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3E69434C.B420FA9D@phekda.freeserve.co.uk>
Date: Sat, 08 Mar 2003 01:11:40 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Re: New POSIX: pwrite [PATCH]
References: <E18rMih-00011k-00 AT phekda DOT freeserve DOT co DOT uk> <200303071845 DOT h27Ij5d18334 AT envy DOT delorie DOT com> <3E6938EC DOT D9BFE2E4 AT phekda DOT freeserve DOT co DOT uk> <200303080038 DOT h280crk23683 AT envy DOT delorie DOT com>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

DJ Delorie wrote:
> 
> > 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().
> 
> DOS only has two types of file things: devices and disk files.  We
> don't need the seek fix on devices.

OK, that's how it currently works.

I thought we were talking about how to detect TTYs that have been redirected
(aka piped), so that we can fail pwrite and set errno == ESPIPE.

> > BTW stdaux and stdprn are not TTYs according to isatty(). Is this a bug?
> 
> Hmmm... probably.  The code in isatty.c looks suspect; it only returns
> true if a device is both stdin *and* stdout.  It should probably also
> just check for device vs file.

I see what you mean. Are all character devices TTYs? Or is that an oxymoronic
question?

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019