1: main(argc, argv) 2: char **argv; 3: { 4: register i, m; 5: register char *c; 6: int count; 7: 8: if(argc < 3) { 9: printf("arg count\n"); 10: exit(1); 11: } 12: c = argv[1]; 13: m = 0; 14: for(m=0; *c; c++) { 15: if(*c < '0' || *c > '7') { 16: printf("bad mode\n"); 17: exit(1); 18: } 19: m = (m<<3) | *c - '0'; 20: } 21: for(i=2; i<argc; i++) 22: if(chmod(argv[i], m) < 0) { 23: count++; 24: perror(argv[i]); 25: } 26: exit(count); 27: }