Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello I need help on writing and fixing my mistakes on a program using system ca

ID: 3638556 • Letter: H

Question

Hello I need help on writing and fixing my mistakes on a program using system calls that changes the permissions on a file. The program can be written in C or C++.

The executable should be called mychmod and should be executed by:

mychmod -u rwx -g rwx -o rwx -U rwx -G rwx -O rwx file1 file2 ...

The lowercase options add permissions and the uppercase options will remove permissions. Each of the switches is optional and should be interpreted as the ones in the Unix command chmod(1).The permissions can be speci?ed as any permutation of the string rwx, and can be split over multiple switches such as:


mychmod -u r -u wx -g rx -G w -O wrx file1 file2 ...

If the command cannot be properly parsed, or if there is no file specifed, it should print a help message to show usage of the command and exit with a status value of 1. As well as send the help message to stderr.


A successful execution of command is indicated by a return status of 0.

Explanation / Answer

again: if ((n = read(fd, buf, BUFFSIZE)) < 0) { if (errno == EINTR) goto again; //just an interrupted system cal /* * handle other errors */ }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote