home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / dos / compat / d_close.c next >
Encoding:
C/C++ Source or Header  |  1995-10-09  |  622 b   |  31 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. /*
  3.  * D_CLOSE.C.
  4.  *
  5.  * Written by Peter Sulyok 1995 <sulyok@math.klte.hu>.
  6.  *
  7.  * This file is distributed WITHOUT ANY WARRANTY; without even the implied
  8.  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9.  *
  10.  */
  11.  
  12. #include <libc/dosio.h>
  13. #include <dpmi.h>
  14. #include <errno.h>
  15. #include <dos.h>
  16.  
  17. unsigned int _dos_close(int handle)
  18. {
  19.   __dpmi_regs r;
  20.  
  21.   r.h.ah = 0x3E;
  22.   r.x.bx = handle;
  23.   __dpmi_int(0x21, &r);
  24.   if ( r.x.flags & 1 )
  25.   {
  26.     errno  = __doserr_to_errno(r.x.ax);
  27.     return r.x.ax;
  28.   }
  29.   return 0;
  30. }
  31.