summaryrefslogtreecommitdiff
path: root/tools/libltgrey.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libltgrey.c')
-rw-r--r--tools/libltgrey.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/tools/libltgrey.c b/tools/libltgrey.c
index 1bf7e9f..38657e3 100644
--- a/tools/libltgrey.c
+++ b/tools/libltgrey.c
@@ -76,10 +76,12 @@ void exeunt(const int sts){
// constructor
whatsit::whatsit(const std::string name, const std::string _parent_dir)
: parent_dir(_parent_dir), progname(name), mypid(getpid()),
- mod_age(0), ac_age(0),
verbosity(0)
{
- gettimeofday(&now, NULL);
+// expand the codes to make some <const int> names:
+# define foo(name) decode_40[name] = #name;
+ state_40_macro
+# undef foo
}
void whatsit::dump(const string var){
@@ -399,3 +401,24 @@ int whatsit::check_dns_sub(const char* ipvar, const char* namevar,
done:
return 0;
}
+
+state_40 whatsit::get40(const string mid){
+ string fname = parent_dir + "/quarante/mid_" + mid;
+ cerr << ".... " << fname << endl;
+ struct stat mid_stat;
+ int rslt = stat(fname.c_str(), &mid_stat);
+ if (rslt != 0) {
+ if (errno == ENOENT) return unseen;
+ cerr << progid << " stat: unexpected failure for '"
+ << fname << "' : ";
+ perror(0);
+ return fail;
+ }
+ timeval now;
+ gettimeofday(&now, NULL);
+ int mod_age = now.tv_sec - mid_stat.st_mtime;
+// int ac_age = now.tv_sec - mid_stat.st_atime;
+ if (mod_age < minimum_age) return young;
+ if (mod_age < probation) return ripe;
+ return spoiled;
+}