Sender: crough45 AT amc DOT de Message-Id: <97Jul8.133945gmt+0100.16649@internet01.amc.de> Date: Tue, 8 Jul 1997 12:43:42 +0100 From: Chris Croughton Mime-Version: 1.0 To: eliz AT is DOT elta DOT co DOT il Cc: djgpp AT delorie DOT com Subject: Re: interesting redir behavior Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Eli Zaretskii wrote: > The `dup' calls force the new handle to refer > to the same file/device as the other handle, > but they create a new handle, they cannot be used > to force the new handle be 1 (or any other specific > number). The numbering of handles is done by the OS. Are you saying that DJGPP's implementation of dup2 is broken? Unix dup2 (int dup2(int old, int new);) lets you specify the new handle; if the handle is currently open it will close it first. The MSDOS function 0x46 does exactly the same. If DJGPP fails to do this then its library is broken and this needs to go in the bug report system. Under all other versions of MSDOS C I've used (Borland and MS, several versions of each) saying: int fd = open("...", ...); dup2(fd, 1); has worked fine... Chris C