Question: #include #include #include #include #include #include #include #include #include #include / / returns difference in times between a - b; positive return means a is
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
returns difference in times between ab; positive return means a is
newer than b; negative indicates b is newer than a
long difftimespecstruct timespec a struct timespec b
long diff atvsec btvsec;
ifdiff
return diff;
diff atvnsec btvnsec;
return diff;
int mainint argc, char argv
if argc
fprintfstderr "Usage: s
argv;
exitEXITFAILURE;
char file argv;
char file argv;
TODO: check that file and file both exist. If one of the
following situatinos arises, print an appropriate message and
exit with code
Both FILE and FILE cannot be accessed
FILE cannot be accessed
FILE cannot be accessed
Replace FILEFILE with the names of the files
YOUR LINES OF CODE HERE
Now that both files exist, compare time stamps for them
TODO: Call stat on each file and extract their stmtim field
which is a struct timespec indicating the last modification
time for the file. Pass these two to the provided difftimespec
function and use the result to print a message according the
following situations.
FILE and FILE are EQUAL in age
FILE is OLDER than FILE
FILE is NEWER than FILE
YOUR LINS OF CODE HERE
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
