Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Dec 2000 17:13:45 -0500
From:      Ryan Younce <ryan@manunkind.org>
To:        Garance A Drosihn <drosih@rpi.edu>
Cc:        Ryan Younce <ryan@manunkind.org>, Sue Blake <sue@welearn.com.au>, freebsd-questions@FreeBSD.ORG
Subject:   Re: "unbuffered" ?
Message-ID:  <20001202171345.C40048@cheshire.manunkind.org>
In-Reply-To: <p04330103b64f1ff04070@[128.113.24.47]>; from drosih@rpi.edu on Sat, Dec 02, 2000 at 05:01:38PM -0500
References:  <20001202224250.L377@welearn.com.au> <p04330106b64f0472caa4@[128.113.24.47]> <20001202152647.A40048@cheshire.manunkind.org> <p04330103b64f1ff04070@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake Garance A Drosihn <drosih@rpi.edu>:
> I tried 'ls'
> vs      'ls | more'
> 
> and ls still treated the second case as "not a tty".  This is
> understandable, as stdout to 'ls' is not a tty, it is the stdin
> for 'more'.

Right.  Pipes are not considered terminals, they are considered files.
isatty() will return false if the descriptor is a file.

> I am not sure if that has any bearing on what you meant to say,
> but given the context some people might think that you meant
> that './myprog' could possibly fix the buffering problem by
> calling isatty().  It can not.  That 'more' could just as
> easily be a 'grep', which means some lines might go to stdout,
> and other lines would not.  Once lines enter a pipe, there is
> no way for the initial process to know whether those lines are
> "really going to wind up" on the terminal.

That wasn't my meaning at all.  isatty() has nothing to do with setbuf().
As far as "ls | grep ...", STDOUT_FILENO within ls will still be considered
a file, that is, not a terminal, regardless of what grep does with it's
output.  My original meaning was that it was very possible for the original
process to determine whether its output was going to a file, or to a terminal.

-- 
Ryan Younce   /   Registered Libertarian Voter | The notion of a 'record' is
ryan@manunkind.org    www.manunkind.org/~ryan/ | an obsolete  remnant of the
ICQ H:4433228 W:74390437   AIM:CheshireCoolCat | days of the 80-column card.
Blitherings:  http://cheshire.livejournal.com/ |        -- Dennis M. Ritchie


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001202171345.C40048>