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

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. /*
  3.  * D_FINDN.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/stubs.h>
  13. #include <libc/dosio.h>
  14. #include <go32.h>
  15. #include <errno.h>
  16. #include <dpmi.h>
  17. #include <dos.h>
  18.  
  19. unsigned int _dos_findnext(struct _find_t *result)
  20. {
  21.   __dpmi_regs r;
  22.  
  23.   r.x.dx = __tb & 15;
  24.   r.x.ds = __tb / 16;
  25.   r.h.ah = 0x1A;
  26.   __dpmi_int(0x21, &r);
  27.   dosmemput(result, sizeof(struct _find_t), __tb);
  28.   r.h.ah = 0x4F;
  29.   __dpmi_int(0x21, &r);
  30.   if ( r.x.flags & 1 )
  31.   {
  32.     errno = __doserr_to_errno(r.x.ax);
  33.     return r.x.ax;
  34.   }
  35.   dosmemget(__tb, sizeof(struct _find_t), result);
  36.   return 0;
  37. }
  38.