Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Aincluberstatio. ho tincluabectedilo, is tinclude esys / stat . hs todefine WFIE 1 0 wotd cap ( const char * , the _ t )
Aincluberstatio. ho
tincluabectedilo, is
tinclude esysstat hs
todefine WFIE
wotd capconst char thet;
struct stat sb;
Int aeinInt arge, char arge
Int
tinet lesttine GIFTLE;
if
it;
if ares MrTif
wit;
J
frtnitislirat im
forj jse seret; jes
if sovsan
xit;
instt inejhatnt ins;
for ;
t
forj; is argt; j
inttiarj;
:
j
woid tow const thar nene tinet last
foss long ss statics sbout the file cas be resi check the wolification tive of
t
fprintfstderr "lookout: ks changedly", nane;
exit;
j
Modify the template program, "lookout. on p with the following additional capabilities
a Repeat the following steps times this means, after seconds of running, your program
should terminate without printing anything if there is no change detected.
i Wait seconds using "sleep call
ii Call "stat" system call to extract the file attributes against given files in command
line arguments the lookout, c program in p may accept up to files Your
program should be able to accept up to filles for monitoring.
iii. You program should check any changes in any of the following attributes:
stmode
stuoliok
st size
statime
st motime
iv When your program detects any changes, your program should immediately print
out number codes given below and EXIT!
Change of stmode print
Change of stnlink print
Change of stsizeprint
Change of statime print
Change of stmtime print
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 using vi:
If your program prints more than one number code, then place spaces in
between.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started