1 --- t-prot 2009-12-30 22:34:16.000000000 +0100
2 +++ t-prot-gol 2009-12-30 22:35:36.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.10';
10 use constant REV => '';
11 use constant REL => q$Revision: 1.267 $=~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]+)(?:,(\S+))?$/$2/) {
40 +if (!Getopt::Long::GetOptions(
46 + 'debug|d' => \$sysl,
49 + 'ftr-ad' => \$ftr_ad,
50 + 'ftr-ml' => \$ftr_ml,
51 + 'groupwise' => \$gw,
60 + 'lax-security' => \$lax,
61 + 'locale=s' => \$locale,
62 + 'max-lines=i' => \$maxlines,
63 + 'ms-smart' => \$ms_smart,
69 + 'pgp-short' => \$pgpshort,
70 + 'pgp-move' => \$pgpmove,
71 + 'pgp-move-vrf' => \$pgpmovevrf,
75 + 'sigsmax:i' => \$_ta,
78 + 'version|v' => \$_tb,
84 - if ($foo =~ /^ratio=(0?\.\d+)$/) {
85 - $check_ratio = $1?$1:1;
88 +# clean up temp vals:
90 + if ($_t1 !~ /^(?:(\d+)(?:,(\d+))?)?$/) { help(); }
93 + if ($bigqn<=0 || $bigqx<=0 || $bigqn<=$bigqx) { help(); }
95 +if (defined $_t2) { help(); }
96 +if (defined $_t3) { $kminl = $_t3; $kamm = 1; }
97 +if (defined $_t4) { $kmaxl = $_t4; $kamm = 1; }
98 +if (defined $_t5) { $kdiff = $_t5; $kamm = 1; }
99 +if (defined $_t6) { $lsig = $_t6 ? $_t6 : $maxsig; }
102 + # mutt still displays the message when ^C'ing pgp verification:
103 + if ($mua eq 'mutt') { $SIG{'INT'} = 'sigint_handler'; }
105 +if (defined $_t8) { $mda = $_t8 ? $_t8 : '1'; }
108 + while ($_t9 && $_t9 =~ s/^([^,\s]+)(?:,(\S+))?$/$2/) {
110 + if ($foo =~ /^ratio=(0?\.\d+)$/) { $check_ratio = $1?$1:1; }
112 - elsif ($opt eq 'd') { $sysl = 1; }
113 - elsif ($opt eq 'diff') { $diff = 1; }
114 - elsif ($opt eq 'e') { $elli = 1; }
115 - elsif ($opt eq 'ftr-ad') { $ftr_ad = 1; $ad = 1; }
116 - elsif ($opt eq 'ftr-ml') { $ftr_ml = 1; $ml = 1; }
117 - elsif ($opt eq 'groupwise') { $gw = 1; }
118 - elsif ($opt eq 'i') { $ifile = $val; }
119 - elsif ($opt eq 'k') { $kamm = 1; }
120 - elsif ($opt eq 'kminl') { $kminl = $val; $kamm = 1; }
121 - elsif ($opt eq 'kmaxl') { $kmaxl = $val; $kamm = 1; }
122 - elsif ($opt eq 'kdiff') { $kdiff = $val; $kamm = 1; }
123 - elsif ($opt eq 'L') { $footers = $val; }
124 - elsif ($opt eq 'l') { $ml = 1; }
125 - elsif ($opt eq 'lax-security') { $lax = 1; }
126 - elsif ($opt eq 'locale') { $locale = $val; }
127 - elsif ($opt eq 'm') { $ms = 1; }
128 - elsif ($opt eq 'max-lines') { $maxlines = $val; }
129 - elsif ($opt eq 'ms-smart') { $ms_smart = 1; $ms = 1; }
130 - elsif ($opt eq 'M') {
133 - if ($mua eq 'mutt') {
134 - # mutt still displays the message when ^C'ing pgp verification:
135 - $SIG{'INT'} = 'sigint_handler';
138 - elsif ($opt eq 'o') { $ofile = $val; }
139 - elsif ($opt eq 'P') { $boun = $val; }
140 - elsif ($opt eq 'p') { $mda = $val ? $val : '1'; }
141 - elsif ($opt eq 'pgp-short') { $pgpshort = 1; }
142 - elsif ($opt eq 'pgp-move') { $pgpmove = 1; }
143 - elsif ($opt eq 'pgp-move-vrf') { $pgpmovevrf = 1; }
144 - elsif ($opt eq 'r') { $hdrs = 1; }
145 - elsif ($opt eq 'S') { $lsig = $val ? $val : $maxsig; }
146 - elsif ($opt eq 's') { $sig = 1; }
147 - elsif ($opt eq 'sigsmax') { $sign = $val ? $val : undef; }
148 - elsif ($opt eq 'spass') { $spass = 1; }
149 - elsif ($opt eq 't') { $trad = 1; }
150 - elsif ($opt eq 'v') { version(); }
151 - elsif ($opt eq 'w') { $trsp = 1; }
154 -Getopt::Mixed::cleanup();
155 -if (($ml && $footers eq '')|| # no -l without -L
156 - ($ad && $ads eq '')|| # no -a without -A
157 - ($nohdr && $pgpshort)|| # --body and --pgp-short are like oil and water
158 - ($ifile eq '')|| # no empty -i
159 - ($ofile eq '')) # no empty -o
162 +if (defined $_ta) { $sign = $_ta ? $_ta : undef; }
163 +if (defined $_tb) { version(); }
164 +if ($ms_smart) { $ms = 1; }
166 if ($mua eq 'mutt') {
167 if (defined $locale && $locale ne '' && $locale ne 'C' && $locale ne 'POSIX') {
168 @@ -1053,11 +1052,15 @@
175 - if ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
177 +elsif ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
179 +if (($ml && $footers eq '')|| # no -l without -L
180 + ($ad && $ads eq '')|| # no -a without -A
181 + ($nohdr && $pgpshort)|| # --body and --pgp-short are like oil and water
182 + ($ifile eq '')|| # no empty -i
183 + ($ofile eq '')) # no empty -o