home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / dos / io / lock.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-01  |  383 b   |  20 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <io.h>
  3. #include <errno.h>
  4.  
  5. int
  6. lock(int fd, long offset, long length)
  7. {
  8.   int ret = _dos_lock(fd, offset, length);
  9.   /* change return code because Borland does it this way */
  10.   if (ret == 0x21)
  11.     ret = EACCES;
  12.   if (ret != 0)
  13.   {
  14.     errno = ret;
  15.     return -1;
  16.   }
  17.   else
  18.     return 0;
  19. }
  20.