vince@fluke.UUCP (Craig V. Johnson) (03/07/85)
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! /