home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / dos / lfn / lfnftime.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-26  |  579 b   |  31 lines

  1. #include <libc/stubs.h>
  2. #include <errno.h>
  3. #include <fcntl.h>
  4. #include <dpmi.h>
  5. #include <libc/dosio.h>
  6.  
  7. unsigned
  8. _lfn_get_ftime (int fhandle, int which)
  9. {
  10.   unsigned xtime;
  11.   __dpmi_regs r;
  12.  
  13.   if (which != _LFN_CTIME && which != _LFN_ATIME)
  14.     {
  15.       errno = EINVAL;
  16.       return 0;
  17.     }
  18.   r.x.ax = which == _LFN_ATIME ? 0x5704 : 0x5706;
  19.   r.x.bx = fhandle;
  20.   __dpmi_int (0x21, &r);
  21.   if (r.x.flags & 1)
  22.     {
  23.       errno = __doserr_to_errno (r.x.ax);
  24.       return 0;
  25.     }
  26.   xtime = r.x.dx;
  27.   xtime = (xtime << 16) | r.x.cx;
  28.   return xtime;
  29. }
  30.  
  31.