Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2.fluke 9/24/84; site vax2.fluke.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!houxm!vax135!cornell!uw-beaver!fluke!vince
From: vince@fluke.UUCP (Craig V. Johnson)
Newsgroups: net.unix-wizards
Subject: Help w/pipes and stdout
Message-ID: <431@vax2.fluke.UUCP>
Date: Thu, 7-Mar-85 14:06:43 EST
Article-I.D.: vax2.431
Posted: Thu Mar  7 14:06:43 1985
Date-Received: Sat, 9-Mar-85 06:21:05 EST
Distribution: net
Organization: John Fluke Mfg. Co., Inc., Everett, WA
Lines: 30

I'm sure this is trivial stuff to many of you experts but after several hours
of manual perusal I have come up confused.  The following all applies to a
4.2BSD system.

Could someone explain to me how a process can tell if stdout is connected to
a tty, file, or pipe?  I found that the manual for fstat (2) says that it
does not know a file from a pipe, but it also says that it can determine if
fd is associated with a socket.  I thought that a pipe was a special case of
a socket.  What gives?  Is there another, perhaps simpler, way to get this
information?

Also, I would like to know if it is possible to affect pipe buffering (change
from line to unbuffered) from the receiving end.  I attempted to
"setbuf(stdin,0)" but it did not achieve the desired affect.  Apparently, the
other end of the pipe was still set up for line buffering.

What I would like to do is terminal emulation which captures stdout,
processes it and then passes it on to the real tty.  Ideally, I could

	csh | terminal_emulator

and I would have a shell with output being translated from one terminal type
to another.  Can anybody advise me?  By the way, I do not have super-user
privledges so possible solutions should not hinge on that condition.

	Craig Johnson			uw-beaver!	\
	John Fluke Mfg. Co., Inc.	decvax!microsof!  \
	Everett, Washington		ucbvax!lbl-csam!    >  fluke!vince
					allegra!	  /
					ssc-vax!	/