Redirection of stderr

Chris Torek torek at elf.ee.lbl.gov
Fri Mar 22 19:03:50 AEST 1991


>>In article <524 at bria> uunet!bria!mike writes:
>>>#define fdup2(A,B)	(memcpy(B,A,sizeof(FILE)))	/* UGLY */

>In article <11127 at dog.ee.lbl.gov> I wrote:
>>Not only that, it does not work---because there is no guarantee that
>>a FILE object holds the state. [...]

(Perhaps `does not' was too strong; but I wanted to scare people away....)

In article <536 at bria> uunet!bria!mike writes:
>As I leap to my defense ...
>
>'Twould be true to state that it does not work for all implementations;
>works just swimmingly for me, though! :-)

Actually, it works under my stdio as well, and on most machines it is
sheer insanity to write one's stdio such that it will fail.  But it is
dangerous to assume that, because it works now, it will always work.
Code that uses an `fdup2' concept at all is probably best ported by
fixing the code, rather than making `fdup2' work.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.unix.internals mailing list