/* * changemod * * Usage: changemod filename * Sets the users execute permission */ #include #include #include #define XPERM 0100 main(int argc, char *argv[]) { struct stat statbuf; if (argc != 2) printf("Usage: changemod file\n"); if (stat(argv[1], &statbuf)< 0) { perror("Could not get file atttributes\n"); exit (1); } statbuf.st_mode = statbuf.st_mode | XPERM; if (chmod(argv[1], statbuf.st_mode) < 0) { perror("Could not set execute permission\n"); exit (1); } exit (0); }