update for HEAD-2003021201
[reactos.git] / lib / crtdll / io / dup.c
1 /* $Id$ */
2 #include <windows.h>
3 #include <msvcrt/io.h>
4 #include <msvcrt/internal/file.h>
5
6 // fixme change type of mode argument to mode_t
7
8 int __fileno_alloc(HANDLE hFile, int mode);
9 int __fileno_getmode(int _fd);
10
11 int _dup(int handle)
12 {
13     HANDLE hFile;
14     int fd;
15     hFile = _get_osfhandle(handle);
16         fd = __fileno_alloc(hFile, __fileno_getmode(handle));
17     return fd;
18 }