Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hp-pcd.UUCP Path: utzoo!linus!decvax!genrad!grkermit!masscomp!clyde!floyd!harpo!seismo!hao!hplabs!hp-pcd!hpfcla!hp-dcd!donn From: donn@hp-dcd.UUCP Newsgroups: net.unix-wizards Subject: Re: What is the dup2() command ? - (nf) Message-ID: <2532@hp-pcd.UUCP> Date: Wed, 23-Nov-83 03:32:49 EST Article-I.D.: hp-pcd.2532 Posted: Wed Nov 23 03:32:49 1983 Date-Received: Sat, 26-Nov-83 04:35:06 EST Sender: notes_gateway@hp-pcd.UUCP Organization: Hewlett-Packard, Fort Collins, CO Lines: 17 #R:bpa:-19200:hp-dcd:3200004:000:408 hp-dcd!donn Nov 16 09:42:00 1983 On dup2(). A emulation using fcntl and F_DUPFD was suggested, but it doesn't always work. If you read dup2() documentation carefully it does a dup to *exactly* its argument, doing a close if necessary. Fcntl does it to the first available slot >= its argument. Thus the suggested emulation doesn't always work. The emulation is: close(arg); fcntl(fd, F_DUPFD, arg); Donn Terry ...hplabs!hp-dcd!donn