Mail Archives: djgpp-workers/1999/04/23/13:52:30
--Message-Boundary-22108
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
> Here are patches to implement fsext overrides for dup and dup2.
I revised the patch for dup2 to add the fsext code after the fd == newfd
check.
Attached is the patch.
---
Mark Elbrecht, snowball3 AT usa DOT net
http://snowball.frogspace.net/
--Message-Boundary-22108
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Text from file 'dup.dif'
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/23 17:47:37
***************
*** 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/23 17:47:51
***************
*** 7,19 ****
--- 7,30 ----
#include <errno.h>
#include <io.h>
#include <libc/dosio.h>
+ #include <sys/fsext.h>
int
dup2(int fd, int newfd)
{
__dpmi_regs r;
+ __FSEXT_Function *func;
+
if (fd == newfd)
return newfd;
+ func = __FSEXT_get_function(fd);
+ if (func)
+ {
+ int rv;
+ if (func(__FSEXT_dup2, &rv, &fd))
+ return rv;
+ }
+
__file_handle_set(newfd, __file_handle_modes[fd] ^ (O_BINARY|O_TEXT));
r.h.ah = 0x46;
r.x.bx = fd;
--Message-Boundary-22108--
- Raw text -