Question: Create a C function with the following capabilities:prog.c: Modify the template program, lookout.c on p . 5 6 - 5 7 with the following additional

Create a C function with the following capabilities:prog.c: Modify the template program, lookout.c on p.56-57 with the following additional capabilitiesa. Repeat the following steps 5 times (this means, after 5 seconds of running, your program should terminate without printing anything if there is no change detected.)i. Wait 1 seconds using sleep(1) callii. Call stat system call to extract the file attributes against given files in command line arguments (the lookout.c program in p.56 may accept up to 10 files). Your program should be able to accept up to 10 files for monitoring.iii. You program should check any changes in any of the following attributes:1. st_mode2. st_nlink3. st_size4. st_atime5. st_mtimeiv. When your program detects any changes, your program should immediately print out number codes given below and EXIT!1. Change of st_mode print 12. Change of st_nlink print 23. Change of st_size print 34. Change of st_atime print 45. Change of st_mtime print 56. Once printing is done, your program should terminate. Make sure your condition checking and printing should be done in the above order! Make sure you print number codes in one line (without any newline character)!7. Example output when you change the file contents (e.g, using vi): 3458. If your program prints more than one number code, then place spaces in between.Important: if your program doesnt print the corresponding number codes or if it prints more information than number codes, then your program will fail the tests, and you will get zero point for the tests. If there is no change detected during your program's execution, your program should exit without printing anything.Testing of your program can be done by opening two terminals, and run lookout in one terminal and, in another terminal, make some changes to the file contents, file permission modes, number of links, by using a variety of shell commands such as vi, chmod, link, unlink, etc.In the terminal where lookout.c is running, the program should print the assigned code into display and exit. You need to submit prog.c into codePost.io in the same way as before.

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!