1: /*
2: char id_chmod[] = "@(#)chmod_.c 1.2";
3: *
4: * chmod - change file mode bits
5: *
6: * synopsis:
7: * integer function chmod (fname, mode)
8: * character*(*) fname, mode
9: */
10:
11: #include "../libI77/fiodefs.h"
12: #include <sys/param.h>
13: #ifndef MAXPATHLEN
14: #define MAXPATHLEN 128
15: #endif
16:
17: ftnint chmod_(name, mode, namlen, modlen)
18: char *name, *mode;
19: ftnlen namlen, modlen;
20: {
21: char nambuf[MAXPATHLEN];
22: char modbuf[32];
23: int retcode;
24:
25: if (namlen >= sizeof nambuf || modlen >= sizeof modbuf)
26: return((ftnint)(errno=F_ERARG));
27: g_char(name, namlen, nambuf);
28: g_char(mode, modlen, modbuf);
29: if (nambuf[0] == '\0')
30: return((ftnint)(errno=ENOENT));
31: if (modbuf[0] == '\0')
32: return((ftnint)(errno=F_ERARG));
33: if (fork())
34: {
35: if (wait(&retcode) == -1)
36: return((ftnint)errno);
37: return((ftnint)retcode);
38: }
39: else
40: execl("/bin/chmod", "chmod", modbuf, nambuf, (char *)0);
41: }
Defined functions
Defined macros