📄 _dup2.c
字号:
/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
#ifdef __DJGPP__
#include <libc/stubs.h>
#include <unistd.h>
#include <fcntl.h>
#include <dpmi.h>
#include <errno.h>
#include <io.h>
#include <libc/dosio.h>
#include <sys/fsext.h>
int
_dup2(int fd, int newfd)
{
__dpmi_regs r;
int old_enable, old_ctrl_c;
if (fd == newfd)
return newfd;
__file_handle_set(newfd, __file_handle_modes[fd] ^ (O_BINARY|O_TEXT));
r.h.ah = 0x46;
r.x.bx = fd;
r.x.cx = newfd;
__dpmi_int(0x21, &r);
if (r.x.flags & 1)
{
errno = __doserr_to_errno(r.x.ax);
return -1;
}
setmode(newfd, __file_handle_modes[fd]);
return newfd;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -