home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
LIBSRC.ZOO
/
libsrc
/
local
/
dup2.c
< prev
next >
Wrap
Text File
|
1992-02-16
|
556b
|
32 lines
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#include <os2.h>
#include <errno.h>
ULONG Dos32DupHandle() asm ("Dos32DupHandle");
ULONG Dos32Close() asm ("Dos32Close");
int dup2 (int oldd, int newd)
{
int newdesc = newd;
ULONG rc;
rc = Dos32DupHandle (oldd, (PHFILE)&newd);
if (rc)
if (rc == ERROR_TOO_MANY_OPEN_FILES)
{
errno = EMFILE;
return (-1);
}
else
{
errno = EBADF;
return (-1);
}
Dos32Close (oldd);
return (newdesc);
}