Message-Id: <199904222210.WAA36614@out4.ibm.net> From: "Mark E." To: djgpp-workers AT delorie DOT com Date: Thu, 22 Apr 1999 18:10:51 -0400 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: fsext patches for dup and dup2 X-mailer: Pegasus Mail for Win32 (v3.01d) Reply-To: djgpp-workers AT delorie DOT com Here are patches to implement fsext overrides for dup and dup2. Index: djgpp/src/libc/posix/unistd/dup.c ======================================================= ============ RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/dup.c,v retrieving revision 1.1 diff -c -3 -r1.1 dup.c *** dup.c 1995/02/27 00:43:08 1.1 --- dup.c 1999/04/22 22:07:13 *************** *** 10,15 **** --- 10,23 ---- dup(int fd) { __dpmi_regs r; + __FSEXT_Function *func = __FSEXT_get_function(fd); + if (func) + { + int rv; + if (func(__FSEXT_dup, &rv, &fd)) + return rv; + } + r.h.ah = 0x45; r.x.bx = fd; __dpmi_int(0x21, &r); Index: djgpp/src/libc/posix/unistd/dup2.c ======================================================= ============ RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/dup2.c,v retrieving revision 1.3 diff -c -3 -r1.3 dup2.c *** dup2.c 1996/09/29 10:20:56 1.3 --- dup2.c 1999/04/22 22:07:24 *************** *** 12,17 **** --- 12,25 ---- dup2(int fd, int newfd) { __dpmi_regs r; + __FSEXT_Function *func = __FSEXT_get_function(fd); + if (func) + { + int rv; + if (func(__FSEXT_dup2, &rv, &fd)) + return rv; + } + if (fd == newfd) return newfd; __file_handle_set(newfd, __file_handle_modes[fd] ^ (O_BINARY|O_TEXT)); --- Mark Elbrecht, snowball3 AT usa DOT net http://snowball.frogspace.net/