/* written by Jarett Stevens program to return true (0) if a file is older than a given number of seconds usage: older */ #include #include #include #include #include #include int main(int argc, char **argv) { long int seconds = 0 ; time_t curr_time ; struct stat old_file_stat ; /* usage: older */ if (argc != 3) return(1) ; seconds = atoi(argv[1]) ; if (seconds <1) return(1) ; curr_time = time(NULL); if ( stat(argv[2], &old_file_stat) ) { perror(argv[2]) ; return(1) ; } if ((curr_time - old_file_stat.st_mtime) > seconds ) return(0) ; else return(1) ; }