home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / dos / io / _chmod.c next >
Encoding:
C/C++ Source or Header  |  1996-08-31  |  681 b   |  34 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <libc/stubs.h>
  3. #include <io.h>
  4. #include <errno.h>
  5. #include <go32.h>
  6. #include <dpmi.h>
  7. #include <fcntl.h>
  8. #include <libc/dosio.h>
  9.  
  10. int
  11. _chmod(const char *filename, int func, ...)
  12. {
  13.   __dpmi_regs r;
  14.  
  15.   if(_USE_LFN) {
  16.     r.x.ax = 0x7143;
  17.     r.h.bl = func;            /* Get or Put */
  18.   } else
  19.     r.x.ax = 0x4300 + func;
  20.   _put_path(filename);
  21.   if (func == 1)
  22.     r.x.cx = *(&func + 1);        /* Value to set */
  23.   r.x.dx = __tb_offset;
  24.   r.x.ds = __tb_segment;
  25.   __dpmi_int(0x21, &r);
  26.   if(r.x.flags & 1)
  27.   {
  28.     errno = __doserr_to_errno(r.x.ax);
  29.     return -1;
  30.   }
  31.  
  32.   return r.x.cx;
  33. }
  34.