From owner-freebsd-questions Sat Dec 2 12:23:59 2000 Delivered-To: freebsd-questions@freebsd.org Received: from cheshire.manunkind.org (cheshire.manunkind.org [216.254.114.213]) by hub.freebsd.org (Postfix) with ESMTP id A1BF037B401 for ; Sat, 2 Dec 2000 12:23:55 -0800 (PST) Received: (from ryan@localhost) by cheshire.manunkind.org (8.11.1/8.11.1) id eB2KQmJ40641; Sat, 2 Dec 2000 15:26:48 -0500 (EST) (envelope-from ryan) Date: Sat, 2 Dec 2000 15:26:47 -0500 From: Ryan Younce To: Garance A Drosihn Cc: Sue Blake , freebsd-questions@FreeBSD.ORG Subject: Re: "unbuffered" ? Message-ID: <20001202152647.A40048@cheshire.manunkind.org> References: <20001202224250.L377@welearn.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from drosih@rpi.edu on Sat, Dec 02, 2000 at 03:08:11PM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Thus spake Garance A Drosihn : > 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