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

next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake Garance A Drosihn <drosih@rpi.edu>:
> But that's if the output is going directly to a terminal.
> Consider:
>      ./myprog | more
> 
> The "myprog" process has no way of knowing that the output is
> really going to some terminal, so that process will feel free
> to buffer output for performance reasons.  This usually is
> the right thing to do when output is going thru a pipe to
> another process, but in the above case this decision might
> not be good.

Actualy, for what it's worth in this thread, myprog can determine whether or
not output is going to a termianl by calling isatty() on STDOUT_FILENO.  This
is how ls(1), for instance, determines whether to use single-column or
multi-column output (ls will print multi-column if output is to a terminal
and single-column if it is to a file, but command-line options can change
this behavior, of course).

-- 
Ryan "Cheshire" Younce | ryan@manunkind.org | http://www.manunkind.org/~ryan

"The only intuitive interface is the nipple.  After that, it's all learned."
                     -- Bruce Ediger, in comp.os.linux.misc, on X interfaces


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?20001202152647.A40048>