home *** CD-ROM | disk | FTP | other *** search
/ Super PC 34 / Super PC 34 (Shareware).iso / spc / UTIL / DJGPP2 / V2 / DJLSR200.ZIP / src / libc / dos / io / _chmod.c next >
Encoding:
C/C++ Source or Header  |  1995-08-10  |  661 b   |  33 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 <libc/dosio.h>
  8.  
  9. int
  10. _chmod(const char *filename, int func, ...)
  11. {
  12.   __dpmi_regs r;
  13.  
  14.   if(_USE_LFN) {
  15.     r.x.ax = 0x7143;
  16.     r.h.bl = func;            /* Get or Put */
  17.   } else
  18.     r.x.ax = 0x4300 + func;
  19.   _put_path(filename);
  20.   if (func == 1)
  21.     r.x.cx = *(&func + 1);        /* Value to set */
  22.   r.x.dx = __tb_offset;
  23.   r.x.ds = __tb_segment;
  24.   __dpmi_int(0x21, &r);
  25.   if(r.x.flags & 1)
  26.   {
  27.     errno = __doserr_to_errno(r.x.ax);
  28.     return -1;
  29.   }
  30.  
  31.   return r.x.cx;
  32. }
  33.