1 --- t-prot 2010-01-08 12:10:26.000000000 +0100
2 +++ t-prot-gol 2010-01-08 12:14:18.000000000 +0100
6 use Fcntl qw(O_EXCL O_WRONLY O_CREAT);
7 -use Getopt::Mixed qw(nextOption);
8 +use Getopt::Long qw(:config gnu_getopt no_ignore_case);
9 use constant VER => '2.12';
10 use constant REV => '';
11 use constant REL => q$Revision: 1.271 $=~m/(\d+(?:\.\d+)+)/;
13 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
14 my $ifile = '-'; # use STDIN if nothing specified
17 +my ($_t1, $_t2, $_t3, $_t4, $_t5, $_t6, $_t7, $_t8, $_t9, $_ta, $_tb) = undef;
19 # get command line params:
20 -Getopt::Mixed::init('a A=s c d e h i=s k L=s l m M=s o=s P=s p:s r S:i'.
21 - ' s t v w bigq:s body check:s debug>d diff ftr-ad ftr-ml groupwise'.
22 - ' help>h kminl=i kmaxl=i kdiff=i lax-security locale=s max-lines=i'.
23 - ' ms-smart mua>M pgp-short pgp-move pgp-move-vrf sigsmax:i spass'.
25 -while (my ($opt, $val, $pretty) = nextOption()) {
26 - if ($opt eq 'a') { $ad = 1; }
27 - elsif ($opt eq 'A') { $ads = $val; }
28 - elsif ($opt eq 'bigq') {
29 - if ($val !~ /^(?:(\d+)(?:,(\d+))?)?$/) { help(); }
32 - if ($bigqn<=0 || $bigqx<=0 || $bigqn<=$bigqx) { help(); }
34 - elsif ($opt eq 'body') { $nohdr = 1; $hdrs = 1; }
35 - elsif ($opt eq 'c') { $cr = 1; }
36 - elsif ($opt eq 'check') {
38 - while ($val && $val =~ /^([^,\s]+)(?:,(\S+))?$/) {
42 - if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) {
43 - $check_ratio = $1?$1:0.75;
47 - elsif ($opt eq 'd') { $sysl = 1; }
48 - elsif ($opt eq 'diff') { $diff = 1; }
49 - elsif ($opt eq 'e') { $elli = 1; }
50 - elsif ($opt eq 'ftr-ad') { $ftr_ad = 1; $ad = 1; }
51 - elsif ($opt eq 'ftr-ml') { $ftr_ml = 1; $ml = 1; }
52 - elsif ($opt eq 'groupwise') { $gw = 1; }
53 - elsif ($opt eq 'i') { $ifile = $val; }
54 - elsif ($opt eq 'k') { $kamm = 1; }
55 - elsif ($opt eq 'kminl') { $kminl = $val; $kamm = 1; }
56 - elsif ($opt eq 'kmaxl') { $kmaxl = $val; $kamm = 1; }
57 - elsif ($opt eq 'kdiff') { $kdiff = $val; $kamm = 1; }
58 - elsif ($opt eq 'L') { $footers = $val; }
59 - elsif ($opt eq 'l') { $ml = 1; }
60 - elsif ($opt eq 'lax-security') { $lax = 1; }
61 - elsif ($opt eq 'locale') { $locale = $val; }
62 - elsif ($opt eq 'm') { $ms = 1; }
63 - elsif ($opt eq 'max-lines') { $maxlines = $val; }
64 - elsif ($opt eq 'ms-smart') { $ms_smart = 1; $ms = 1; }
65 - elsif ($opt eq 'M') {
67 +if (!Getopt::Long::GetOptions(
73 + 'debug|d' => \$sysl,
76 + 'ftr-ad' => \$ftr_ad,
77 + 'ftr-ml' => \$ftr_ml,
78 + 'groupwise' => \$gw,
87 + 'lax-security' => \$lax,
88 + 'locale=s' => \$locale,
89 + 'max-lines=i' => \$maxlines,
90 + 'ms-smart' => \$ms_smart,
96 + 'pgp-short' => \$pgpshort,
97 + 'pgp-move' => \$pgpmove,
98 + 'pgp-move-vrf' => \$pgpmovevrf,
102 + 'sigsmax:i' => \$_ta,
103 + 'spass' => \$spass,
105 + 'version|v' => \$_tb,
111 - if ($mua eq 'mutt') {
112 - # mutt still displays the message when ^C'ing pgp verification:
113 - $SIG{'INT'} = 'sigint_handler';
115 +# clean up temp vals:
117 + if ($_t1 !~ /^(?:(\d+)(?:,(\d+))?)?$/) { help(); }
120 + if ($bigqn<=0 || $bigqx<=0 || $bigqn<=$bigqx) { help(); }
122 +if (defined $_t2) { help(); }
123 +if (defined $_t3) { $kminl = $_t3; $kamm = 1; }
124 +if (defined $_t4) { $kmaxl = $_t4; $kamm = 1; }
125 +if (defined $_t5) { $kdiff = $_t5; $kamm = 1; }
126 +if (defined $_t6) { $lsig = $_t6 ? $_t6 : $maxsig; }
129 + # mutt still displays the message when ^C'ing pgp verification:
130 + if ($mua eq 'mutt') { $SIG{'INT'} = 'sigint_handler'; }
132 +if (defined $_t8) { $mda = $_t8 ? $_t8 : '1'; }
135 + while ($_t9 && $_t9 =~ /^([^,\s]+)(?:,(\S+))?$/) {
138 + if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { $check_ratio = $1?$1:0.75; }
140 - elsif ($opt eq 'o') { $ofile = $val; }
141 - elsif ($opt eq 'P') { $boun = $val; }
142 - elsif ($opt eq 'p') { $mda = $val ? $val : '1'; }
143 - elsif ($opt eq 'pgp-short') { $pgpshort = 1; }
144 - elsif ($opt eq 'pgp-move') { $pgpmove = 1; }
145 - elsif ($opt eq 'pgp-move-vrf') { $pgpmovevrf = 1; }
146 - elsif ($opt eq 'r') { $hdrs = 1; }
147 - elsif ($opt eq 'S') { $lsig = $val ? $val : $maxsig; }
148 - elsif ($opt eq 's') { $sig = 1; }
149 - elsif ($opt eq 'sigsmax') { $sign = $val ? $val : undef; }
150 - elsif ($opt eq 'spass') { $spass = 1; }
151 - elsif ($opt eq 't') { $trad = 1; }
152 - elsif ($opt eq 'v') { version(); }
153 - elsif ($opt eq 'w') { $trsp = 1; }
156 -Getopt::Mixed::cleanup();
157 -if (($ml && $footers eq '')|| # no -l without -L
158 - ($ad && $ads eq '')|| # no -a without -A
159 - ($nohdr && $pgpshort)|| # --body and --pgp-short are like oil and water
160 - ($ifile eq '')|| # no empty -i
161 - ($ofile eq '')) # no empty -o
164 +if (defined $_ta) { $sign = $_ta ? $_ta : undef; }
165 +if (defined $_tb) { version(); }
166 +if ($ms_smart) { $ms = 1; }
168 if ($mua eq 'mutt') {
169 if (defined $locale && $locale ne '' && $locale ne 'C' && $locale ne 'POSIX') {
170 @@ -1053,11 +1052,15 @@
177 - if ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
179 +elsif ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
181 +if (($ml && $footers eq '')|| # no -l without -L
182 + ($ad && $ads eq '')|| # no -a without -A
183 + ($nohdr && $pgpshort)|| # --body and --pgp-short are like oil and water
184 + ($ifile eq '')|| # no empty -i
185 + ($ofile eq '')) # no empty -o