home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / IO / CHMOD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  484 b   |  24 lines

  1. /* chmod.c (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <io.h>
  5. #include <errno.h>
  6. #include <sys/types.h>
  7. #include <sys/stat.h>
  8.  
  9. int chmod (const char *name, int pmode)
  10. {
  11.   int attr, rc;
  12.  
  13.   attr = __chmod (name, 0, 0);           /* Get attributes */
  14.   if (attr < 0)
  15.     return (-1);
  16.   if (pmode & S_IWRITE)
  17.     attr &= ~1;
  18.   else
  19.     attr |= 1;
  20.   rc = __chmod (name, 1, attr);
  21.   if (rc >= 0) rc = 0;
  22.   return (rc);
  23. }
  24.