-
Notifications
You must be signed in to change notification settings - Fork 1
/
mailmovertest
executable file
·67 lines (56 loc) · 1.45 KB
/
mailmovertest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/perl -wT
#
# Copyright 2007-2015 by Christian Jaeger, ch at christianjaeger ch
# Published under the same terms as perl itself
#
(my $email='ch%christianjaeger,ch')=~ tr/%,/@./;
use strict; use warnings FATAL => 'uninitialized';
use Cwd 'abs_path';
our ($mydir, $myname); BEGIN {
my $location= (-l $0) ? abs_path ($0) : $0;
$location=~ /(.*?)([^\/]+?)_?\z/s or die "?";
($mydir, $myname)=($1,$2);
}
use lib "$mydir/lib";
use lib "$mydir/functional-perl/lib";
use Mailmover::Lib;
use Chj::repl;
use Chj::ruse; #?
use FP::Untainted;
$ENV{PATH}= untainted ($ENV{PATH});
# just trust it, it's always under our control, isnt't it?
sub usage {
print STDERR map{"$_\n"} @_ if @_;
print "$myname ..
(Christian Jaeger <$email>)
";
exit (@_ ? 1 : 0);
}
my @args;
my $DEBUG=0;
for (my $i=0; $i<=$#ARGV; $i++) {
local $_=$ARGV[$i];
if (/^--?h(elp)?$/) {
usage
} elsif ($_ eq '--') {
push @args, @ARGV[$i+1..$#ARGV];
last;
} elsif (/^--?d(ebug)?$/) {
$DEBUG=1;
# } elsif (/^--?X(?:XXX(?:=(.*))?)?$/) {
# if (defined $1) {
# $XXX=$1
# } else {
# $XXX=$ARGV[++$i] or usage "missing argument for '$_' option";
# }
} elsif (/^-./) {
usage("Unknown option '$_'\n");
} else {
push @args, $_
}
}
for my $path (@ARGV) {
print "-- $path:\n";
my ($mail,$folderpath,$type,$important)= analyze_file $args[0] if @args;
repl;
}