1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)chmod_.c	5.1	6/7/85
   7:  */
   8: 
   9: /*
  10:  * chmod - change file mode bits
  11:  *
  12:  * synopsis:
  13:  *	integer function chmod (fname, mode)
  14:  *	character*(*) fname, mode
  15:  */
  16: 
  17: #include "../libI77/f_errno.h"
  18: #include <sys/param.h>
  19: #ifndef MAXPATHLEN
  20: #define MAXPATHLEN  128
  21: #endif
  22: 
  23: long chmod_(name, mode, namlen, modlen)
  24: char    *name, *mode;
  25: long    namlen, modlen;
  26: {
  27:     char    nambuf[MAXPATHLEN];
  28:     char    modbuf[32];
  29:     int retcode;
  30: 
  31:     if (namlen >= sizeof nambuf || modlen >= sizeof modbuf)
  32:         return((long)(errno=F_ERARG));
  33:     g_char(name, namlen, nambuf);
  34:     g_char(mode, modlen, modbuf);
  35:     if (nambuf[0] == '\0')
  36:         return((long)(errno=ENOENT));
  37:     if (modbuf[0] == '\0')
  38:         return((long)(errno=F_ERARG));
  39:     if (fork())
  40:     {
  41:         if (wait(&retcode) == -1)
  42:             return((long)errno);
  43:         return((long)retcode);
  44:     }
  45:     else
  46:         execl("/bin/chmod", "chmod", modbuf, nambuf, (char *)0);
  47: }

Defined functions

chmod_ defined in line 23; never used

Defined macros

MAXPATHLEN defined in line 20; used 2 times
Last modified: 1987-02-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2197
Valid CSS Valid XHTML 1.0 Strict