Question: Write a C program called watch that executes a command periodically (e.g., every 2 seconds), showing the output on the standard output (terminal). Your implementation

 Write a C program called watch that executes a command periodically

(e.g., every 2 seconds), showing the output on the standard output (terminal).

Write a C program called watch that executes a command periodically (e.g., every 2 seconds), showing the output on the standard output (terminal). Your implementation of watch does not have to clear the screen like other implementations of watch do. Your program should implement a command line option -n to set the number of seconds that watch sleeps between each repeated execution of the command. The option -b causes the special value a to be written to the standard output if an execution of the command ends with a non-zero exit code (this usually rings the terminal bell). The option -e terminates your watch program when the execution of a command fails. (If -e is not given on the command line, the execution continues irrespective of any failures of the command execution.) Your program must use the fork, execvp), and waitpidO system calls. You are not allowed to use the system) library call. You can let your watch program sleep by calling the sleep library function. $./watch date Tue Sep 13 13:51:33 CEST 2016 Write a C program called watch that executes a command periodically (e.g., every 2 seconds), showing the output on the standard output (terminal). Your implementation of watch does not have to clear the screen like other implementations of watch do. Your program should implement a command line option -n to set the number of seconds that watch sleeps between each repeated execution of the command. The option -b causes the special value a to be written to the standard output if an execution of the command ends with a non-zero exit code (this usually rings the terminal bell). The option -e terminates your watch program when the execution of a command fails. (If -e is not given on the command line, the execution continues irrespective of any failures of the command execution.) Your program must use the fork, execvp), and waitpidO system calls. You are not allowed to use the system) library call. You can let your watch program sleep by calling the sleep library function. $./watch date Tue Sep 13 13:51:33 CEST 2016

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 Databases Questions!