Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83 (MC840302); site boring.UUCP
Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!harpo!decvax!genrad!mit-eddie!think!harvard!seismo!mcvax!boring!jack
From: jack@boring.UUCP
Newsgroups: net.unix-wizards
Subject: Re: "swapfd" (more unix ideas)
Message-ID: <6478@boring.UUCP>
Date: Wed, 26-Jun-85 12:24:06 EDT
Article-I.D.: boring.6478
Posted: Wed Jun 26 12:24:06 1985
Date-Received: Mon, 1-Jul-85 06:00:28 EDT
References: <6954@ucbvax.ARPA> <5687@utzoo.UUCP> <288@azure.UUCP> <8420@ucbvax.ARPA>
Reply-To: jack@boring.UUCP (Jack Jansen)
Organization: CWI, Amsterdam
Lines: 22
Apparently-To: rnews@mcvax.LOCAL


It will get messy very soon. Besides the fact that you have no
idea how often the receiving process has dup()ped the file
descriptor you swapfd(), you should also send it a signal to tell
it that you mucked around with his file descriptors (SIGSWAPFD?).

Every program downto 'ls' looks at stdout to determine wether it is
a terminal nowadays, so you'd better notify it if you change it's
output.

By the way, even if you do so, the program will have a hard time getting
everything right. If you replace stdout by a file descriptor pointing
to another terminal, it will have to reset the mode of the previous
terminal (hoping it can find it...), if it was a terminal, and then
set the mode of the new terminal, if it is a terminal..........

It *would* be nice, though, to have a nice and clean mechanism to
say that you don't want the rest of the output of a command on
the terminal but on a file, but the stress is on *nice and clean*.
-- 
	Jack Jansen, jack@mcvax.UUCP
	The shell is my oyster.