www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/04/23/13:52:30

Message-Id: <199904231752.RAA64682@out5.ibm.net>
From: "Mark E." <snowball3 AT usa DOT net>
To: djgpp-workers AT delorie DOT com
Date: Fri, 23 Apr 1999 13:53:06 -0400
MIME-Version: 1.0
Subject: Re: fsext patches for dup and dup2
X-mailer: Pegasus Mail for Win32 (v3.01d)
Reply-To: djgpp-workers AT delorie DOT com

--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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019