Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!hybrid!chance!john From: john@chance.UUCP (John R. MacMillan) Newsgroups: comp.sys.3b1 Subject: Re: want workaround for "dup2" Keywords: dup2 3b1 unix-pc Message-ID: <1991Mar19.053708.8792@chance.UUCP> Date: 19 Mar 91 05:37:08 GMT References: <1270@hico2.UUCP> <1991Mar18.024543.20223@texrex.uucp> Organization: Haphazard Lines: 13 |>Is there an easy way to provide dup2? | |#include | ... if (fd_to_dup != fd) { | close(fd_to_dup); | newfd=fcntl(fd, F_DUPFD, fd_to_dup); } | ... I'm not sure this is perfect, in particular I'm not sure errno will agree with dup2(), but it's pretty close. The check to see if the fd's are equal isn't always necessary, but when it is...