Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!bionet!agate!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR/AA) Newsgroups: comp.unix.wizards Subject: Re: dup2 on Sys5r2 ish box Message-ID: <1991Apr13.183314.8490@NCoast.ORG> Date: 13 Apr 91 18:33:14 GMT References: <2180@estevax.UUCP> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR/AA) Followup-To: comp.unix.wizards Organization: North Coast Public Access Un*x (ncoast) Lines: 29 As quoted from <2180@estevax.UUCP> by iain@estevax.UUCP (Hr Iain Lea): +--------------- | I am porting a program from BSD to a Sys5r2 ish derivative and need the | dup2() function call. +--------------- Is this one in the FAQ? /* * Near-duplicate for dup2(). ("Near"? We discussed this for a whole bloody * month --- I don't want to discuss it any more. BSD and System V have * enough differing errno values that that part is pointless anyway.) * * Caveats: doesn't necessarily return the same errno values on failure; does * not leave f2 open if the dup fails. */ #include #include #define dup2(f1,f2) (close(f2),fcntl(f1,F_DUPFD,f2)) ++Brandon -- Me: Brandon S. Allbery Ham: KB8JRR/AA on 2m, 220, 440, 1200 Internet: allbery@NCoast.ORG (QRT on HF until local problems fixed) America OnLine: KB8JRR // Delphi: ALLBERY AMPR: kb8jrr.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery KB8JRR @ WA8BXN.OH