Mail Archives: djgpp-workers/1999/04/22/18:11:50
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/
- Raw text -