summaryrefslogtreecommitdiff
path: root/tools/ltgrey.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-31 14:52:41 (GMT)
committerJohn Denker <jsd@av8n.com>2012-07-31 15:13:41 (GMT)
commit53d40691f0285c781a3ca8ab394e29c6baf90c98 (patch)
tree20ef853766d4cc3b1a278d0d2f73852045ccf5a4 /tools/ltgrey.c
parent64b9aec12be7080c3b81e505044b139d56bb07c4 (diff)
basically working: two directories
Diffstat (limited to 'tools/ltgrey.c')
-rw-r--r--tools/ltgrey.c53
1 files changed, 41 insertions, 12 deletions
diff --git a/tools/ltgrey.c b/tools/ltgrey.c
index b707dc2..26d0f64 100644
--- a/tools/ltgrey.c
+++ b/tools/ltgrey.c
@@ -11,10 +11,6 @@ string progname;
#define exeunt exit
-// forward reference:
-void scan(const string progid, const string p, const int copies=1);
-
-
int main(int _argc, char** _argv){
std::string hostname;
std::string ipname;
@@ -24,17 +20,23 @@ int main(int _argc, char** _argv){
char** argv(_argv);
const string parent_dir("/var/qmail/ltgrey");
whatsit foo(argv[0], parent_dir); argc--; argv++;
- int scanmode(0);
+ int scan40mode(0);
+ int scanrepmode(0);
int copies(1);
int shift(0);
int stain(0);
int dns_mode(0);
string get_40_mid;
- string set40_mid;
+ string set_40_mid;
+ string get_rep_mid;
+ string set_rep_mid;
while (argc > 0) {
string arg = argv[0]; argc--; argv++;
- if (prefix(arg, "-scan40")) {
- scanmode++;
+ if (0){
+ } else if (prefix(arg, "-scan40")) {
+ scan40mode++;
+ } else if (prefix(arg, "-scanrep")) {
+ scanrepmode++;
} else if (prefix(arg, "-copy")) {
copies++;
} else if (prefix(arg, "-verbose")) {
@@ -52,7 +54,19 @@ int main(int _argc, char** _argv){
cerr << "Option '" << arg << "' requires an argument" << endl;
exeunt(ex_syserr);
}
- set40_mid = *argv++; argc--;
+ set_40_mid = *argv++; argc--;
+ } else if (prefix(arg, "-setrep")) {
+ if (!argc){
+ cerr << "Option '" << arg << "' requires an argument" << endl;
+ exeunt(ex_syserr);
+ }
+ set_rep_mid = *argv++; argc--;
+ } else if (prefix(arg, "-getrep")) {
+ if (!argc){
+ cerr << "Option '" << arg << "' requires an argument" << endl;
+ exeunt(ex_syserr);
+ }
+ get_rep_mid = *argv++; argc--;
} else if (prefix(arg, "-shift")
|| prefix(arg, "-shift")) {
if (!argc){
@@ -94,15 +108,30 @@ int main(int _argc, char** _argv){
return 0;
}
- if (set40_mid.length()){
- return foo.set_40(set40_mid, shift);
+ if (set_40_mid.length()){
+ return foo.set_40(set_40_mid, shift);
}
- if (scanmode) {
+ if (get_rep_mid.length()){
+ box_state rslt = foo.get_rep(get_rep_mid);
+ cerr << foo.decode_40[rslt] << endl;
+ return 0;
+ }
+
+ if (set_rep_mid.length()){
+ return foo.set_rep(set_rep_mid, shift);
+ }
+
+ if (scan40mode) {
foo.scan_box(box_40, copies);
return 0;
}
+ if (scanrepmode) {
+ foo.scan_box(box_rep, copies);
+ return 0;
+ }
+
int sts = foo.doit(shift, stain);
return sts;