Question: Aincluberstatio. ho tincluabectedilo, is tinclude esys / stat . hs todefine WFIE 1 0 wotd cap ( const char * , the _ t )

Aincluberstatio. ho
tincluabectedilo, is
tinclude esys/stat. hs
todefine WFIE 10
wotd cap(const char *, the_t);
struct stat sb;
Int aein(Int arge, char *arge)
(1)
Int J
tine_t lest_tine[ GIFTLE+1];
if (?bar(args)bar(2))(
it(1);
if (--ares > MrTif )
wit(1);
J
frtnitislirat im
for(j =1, jse seret; jes)
if (+1=1(-sov(j),san)=-1)
t
xit(1);
]
inst_t ine(j)=*h.at_nt ins;
for (j;)
t
for(j-1; is argt; j*)
, int_tiar(j));
,sen(69) :
}
j
woid tow (const thar *nene, tine_t last)
(.)
foss long ss statics sbout the file cas be resi check the wolification tive of
t.
fprintf(stderr, "lookout: 'ks changedly", nane);
exit(6);
j
Modify the template program, "lookout. 5" on p.56-57 with the following additional capabilities
a. 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)" call
ii. 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 filles for monitoring.
iii. You program should check any changes in any of the following attributes:
stmode
stuoliok
st size
st.atime
st motime
iv. When your program detects any changes, your program should immediately print
out number codes given below and EXIT!
Change of st_mode - print 1
Change of st_nlink- print 2
Change of st_size-print 3
Change of st_atime - print 4
Change of st_mtime - print 5
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)!
Example output when you change the file contents (9.5, using vi): 345
If your program prints more than one number code, then place spaces in
between.
 Aincluberstatio. ho tincluabectedilo, is tinclude esys/stat. hs todefine WFIE 10 wotd

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!