"swapfd" (more unix ideas)

jack at boring.UUCP jack at boring.UUCP
Thu Jun 27 02:24:06 AEST 1985


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 at mcvax.UUCP
	The shell is my oyster.



More information about the Comp.unix.wizards mailing list