summaryrefslogtreecommitdiff
path: root/tools/libltgrey.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libltgrey.h')
-rw-r--r--tools/libltgrey.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/libltgrey.h b/tools/libltgrey.h
new file mode 100644
index 0000000..14ed144
--- /dev/null
+++ b/tools/libltgrey.h
@@ -0,0 +1,51 @@
+#include <string>
+#include <sys/time.h> /* for gettimeofday(), timeval */
+#include <vector>
+#include <map>
+
+// beware: access illogically comes *before* modification
+// in the array passed to utimes:
+const int upd_ac(0);
+const int upd_mod(1);
+
+#define state_40_macro \
+foo(unseen) \
+foo(green) \
+foo(ripe) \
+foo(spoiled) \
+foo(fail)
+
+// expand the codes to make some <const int> names:
+#define foo(name) name,
+typedef enum {
+ state_40_macro
+} state_40;
+#undef foo
+
+class whatsit{
+public:
+ std::string parent_dir;
+ std::string progname;
+ pid_t mypid;
+ std::string suffix;
+ std::string progid;
+ int verbosity;
+ std::map<state_40,std::string> decode_40;
+
+ whatsit(const std::string name, const std::string _parent_dir);
+ int doit(const int penalty, const int stain);
+// access comes after modification:
+ void update(const std::string msg, const timeval new_mod,
+ const timeval new_ac, const int penalty, const int stain);
+ int setup();
+ int check_dns(const char* ipvar, const char* namevar);
+ int check_dns_sub(const char* ipvar, const char* namevar,
+ std::string &addr, std::string &host,
+ std::vector<std::string> &checked);
+ void dump(const std::string var);
+ int maybe_mkdir(const std::string somedir, const std::string msg);
+ state_40 get40(const std::string mid);
+ state_40 get40(const std::string mid, timeval times[2]);
+ int set40(const std::string mid, const int shift);
+ void scan40(const int copies);
+};