Question: 7 . 7 execute execute [ id ] - This built - in command executes the command associated with the List Node. To implement this

7.7 "execute" execute [id]- This built-in command executes the command associated with the List Node. To implement this built in command, you will call the provided function run_command (an implementation of the function has been provided to you which will be linked in during compilation) which will run the command associated with the List Node. The function prototype of the providing function is the following: int run_command(ListNode *); The provided function run_command has an integer return type representing the status information of the command that was ran. You will need to extract the exit status of the return value - the exit status is stored in bits 8-15 of the returned integer. After extracting the exit status, if you get a non zero exit status then the command exit status indicates an unsuccessful execution. If the function returns an unsuccessful execution, then your shell must print an error message by utilizing the following: fprintf(stderr, "error: %s
", strerror(exit_status)); If incorrect number of arguments provided are provided, then you must print an error by utilizing the following: fprintf(stderr, "error: incorrect number of arguments
"); If the id argument provided is not valid, then you must print an error by utilizing the following: fprintf(stderr, "error: %s
","Id does not exist"); Your shell must only execute commands with at most 127 arguments including the command itself. If more than 127 arguments are present, then your shell must print the following error message: "error: too many arguments" by utilizing the following: fprintf(stderr, "error: %s
", "too many arguments"); Assumptions: Failure to follow the assumptions listed for the new built in command will result in the command not being executed (and thus potentially resulting in a segmentation fault). Depending on the command for the List Node, the List Nod

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!