/* See LICENSE file for copyright and license details. */ #include #include #include #include #include "util.h" int main(int argc, char *argv[]) { int retval, filecount, i; mode_t mode; char *input; mode = 0; filecount = argc-1; input = argv[1]; if ( argc < 3 ) { eprintf("?\n"); exit(EXIT_FAILURE); } while ( *input ) { if (*input < '0' || *input > '7') { eprintf("?\n"); exit(EXIT_FAILURE); } mode = ( mode << 3 ) | ( *input - '0' ) ; input++; } retval=0; for (i=2; i <= filecount; i++) { retval = chmod( argv[i], mode ); if (retval != 0) { printf ("? \n"); } } exit(EXIT_SUCCESS); }