Mail Archives: djgpp/1997/07/08/07:48:55
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
- Raw text -