* chmod [ugoa][+-=][rwxstugo] files
#define USER 05700 /* user's bits */
#define GROUP 02070 /* group's bits */
#define OTHER 00007 /* other's bits */
#define ALL 01777 /* all (note absence of setuid, etc) */
#define READ 00444 /* read permit */
#define WRITE 00222 /* write permit */
#define EXEC 00111 /* exec permit */
#define SETID 06000 /* set[ug]id */
#define STICKY 01000 /* sticky bit */
fprintf(stderr
, "Usage: chmod [ugoa][+-=][rwxstugo] file ...\n");
for (i
= 2; i
< argc
; i
++) {
fprintf(stderr
, "chmod: can't access %s\n", p
);
if (chmod(p
, newmode(st
.st_mode
)) < 0) {
fprintf(stderr
, "chmod: can't change %s\n", p
);
fprintf(stderr
, "chmod: invalid mode\n");
while ((c
= *ms
++) >= '0' && c
<= '7')
i
= (i
<< 3) + (c
- '0');
for (;;) switch (*ms
++) {
m
|= (m
<< 3) | (m
<< 6);
for (;;) switch (*ms
++) {