]> git.deb.at Git - pkg/t-prot.git/blob - contrib/t-prot-r1.285-gol.diff
Imported Upstream version 2.15
[pkg/t-prot.git] / contrib / t-prot-r1.285-gol.diff
1 --- t-prot      2010-02-15 21:13:00.000000000 +0100
2 +++ t-prot-gol  2010-02-15 21:20:35.000000000 +0100
3 @@ -4,7 +4,7 @@
4  require 5.006;
5  use strict;
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.15';
10  use constant REV            => '';
11  use constant REL            => q$Revision: 1.285 $=~m/(\d+(?:\.\d+)+)/;
12 @@ -986,87 +986,87 @@
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, 0, 0);
14  my $ifile   = '-';    # use STDIN if nothing specified
15  
16 +# temp vals:
17 +my ($_t1, $_t2, $_t3, $_t4, $_t5, $_t6, $_t7, $_t8, $_t9, $_ta, $_tb, $_tc) = undef;
18 +
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 reply sani sigsmax:i'.
24 -    ' spass version>v');
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(); }
30 -        $bigqn = $1?$1:30; 
31 -        $bigqx = $2?$2:10;
32 -        if ($bigqn<=0 || $bigqx<=0 || $bigqn<=$bigqx) { help(); }
33 -    }
34 -    elsif ($opt eq 'body')  { $nohdr = 1; $hdrs = 1; }
35 -    elsif ($opt eq 'c')     { $cr = 1; }
36 -    elsif ($opt eq 'check') {
37 -        $check = 1;
38 -        while ($val && $val =~ /^([^,\s]+)(?:,(\S+))?$/) {
39 -            my $foo = $1;
40 -            $val = $2;
41 -
42 -            if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) {
43 -                $check_ratio = $1?$1:0.75;
44 -            }
45 -        }
46 -    }
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') {
66 -        $mua = lc($val);
67 +if (!Getopt::Long::GetOptions(
68 +    'a'             => \$ad,
69 +    'A=s'           => \$ads,
70 +    'bigq:s'        => \$_t1,
71 +    'body'          => \$_tc,
72 +    'c'             => \$cr,
73 +    'check:s'       => \$_t9,
74 +    'debug|d'       => \$sysl,
75 +    'diff'          => \$diff,
76 +    'e'             => \$elli,
77 +    'ftr-ad'        => \$ftr_ad,
78 +    'ftr-ml'        => \$ftr_ml,
79 +    'groupwise'     => \$gw,
80 +    'help|h'        => \$_t2,
81 +    'i=s'           => \$ifile,
82 +    'k'             => \$kamm,
83 +    'kminl=i'       => \$_t3,
84 +    'kmaxl=i'       => \$_t4,
85 +    'kdiff=i'       => \$_t5,
86 +    'L=s'           => \$footers,
87 +    'l'             => \$ml,
88 +    'lax-security'  => \$lax,
89 +    'locale=s'      => \$locale,
90 +    'max-lines=i'   => \$maxlines,
91 +    'ms-smart'      => \$ms_smart,
92 +    'mua|M=s'       => \$_t7,
93 +    'm'             => \$ms,
94 +    'o=s'           => \$ofile,
95 +    'P=s'           => \$boun,
96 +    'p:s'           => \$_t8,
97 +    'pgp-short'     => \$pgpshort,
98 +    'pgp-move'      => \$pgpmove,
99 +    'pgp-move-vrf'  => \$pgpmovevrf,
100 +    'r'             => \$hdrs,
101 +    'reply'         => \$reply,
102 +    'S:i'           => \$_t6,
103 +    's'             => \$sig,
104 +    'sani'          => \$sani,
105 +    'sigsmax:i'     => \$_ta,
106 +    'spass'         => \$spass,
107 +    't'             => \$trad,
108 +    'version|v'     => \$_tb,
109 +    'w'             => \$trsp
110 +    )) {
111 +    help();
112 +}
113  
114 -        if ($mua eq 'mutt') {
115 -            # mutt still displays the message when ^C'ing pgp verification:
116 -            $SIG{'INT'} = 'sigint_handler';
117 -        }
118 +# clean up temp vals:
119 +if (defined $_t1) {
120 +    if ($_t1 !~ /^(?:(\d+)(?:,(\d+))?)?$/) { help(); }
121 +    $bigqn = $1?$1:30; 
122 +    $bigqx = $2?$2:10; 
123 +    if ($bigqn<=0 || $bigqx<=0 || $bigqn<=$bigqx) { help(); }
124 +}
125 +if (defined $_t2) { help(); }
126 +if (defined $_t3) { $kminl = $_t3; $kamm = 1; }
127 +if (defined $_t4) { $kmaxl = $_t4; $kamm = 1; }
128 +if (defined $_t5) { $kdiff = $_t5; $kamm = 1; }
129 +if (defined $_t6) { $lsig = $_t6 ? $_t6 : $maxsig; }
130 +if (defined $_t7) {
131 +    $mua = lc($_t7);
132 +    # mutt still displays the message when ^C'ing pgp verification:
133 +    if ($mua eq 'mutt') { $SIG{'INT'} = 'sigint_handler'; }
134 +}
135 +if (defined $_t8) { $mda = $_t8 ? $_t8 : '1'; }
136 +if (defined $_t9) {
137 +    $check = 1;
138 +    while ($_t9 && $_t9 =~ /^([^,\s]+)(?:,(\S+))?$/) {
139 +        my $foo = $1;
140 +        $_t9 = $2;
141 +        if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { $check_ratio = $1?$1:0.75; }
142      }
143 -    elsif ($opt eq 'o')     { $ofile = $val; }
144 -    elsif ($opt eq 'P')     { $boun = $val; }
145 -    elsif ($opt eq 'p')     { $mda = $val ? $val : '1'; }
146 -    elsif ($opt eq 'pgp-short') { $pgpshort = 1; }
147 -    elsif ($opt eq 'pgp-move') { $pgpmove = 1; }
148 -    elsif ($opt eq 'pgp-move-vrf') { $pgpmovevrf = 1; }
149 -    elsif ($opt eq 'r')     { $hdrs = 1; }
150 -    elsif ($opt eq 'reply') { $reply = 1; }
151 -    elsif ($opt eq 'S')     { $lsig = $val ? $val : $maxsig; }
152 -    elsif ($opt eq 's')     { $sig = 1; }
153 -    elsif ($opt eq 'sani')  { $sani = 1; }
154 -    elsif ($opt eq 'sigsmax') { $sign = $val ? $val : undef; }
155 -    elsif ($opt eq 'spass') { $spass = 1; }
156 -    elsif ($opt eq 't')     { $trad = 1; }
157 -    elsif ($opt eq 'v')     { version(); }
158 -    elsif ($opt eq 'w')     { $trsp = 1; }
159 -    else                    { help(); }
160  }
161 -Getopt::Mixed::cleanup();
162 -if (($ml && $footers eq '')||     # no -l without -L
163 -    ($ad && $ads eq '')||         # no -a without -A
164 -    ($nohdr && $pgpshort)||       # --body and --pgp-short are oil and water
165 -    (($nohdr||$hdrs) && ($sani||$reply))|| # no sanitazing without headers :)
166 -    ($ifile eq '')||              # no empty -i
167 -    ($ofile eq ''))               # no empty -o
168 -{ help(); }
169 -
170 +if (defined $_ta) { $sign = $_ta ? $_ta : undef; }
171 +if (defined $_tb) { version(); }
172 +if (defined $_tc) { $nohdr=1; $hdrs=1; }
173 +if ($ms_smart) { $ms = 1; }
174  
175  if ($mua eq 'mutt') {
176      if (defined $locale && $locale ne '' && $locale ne 'C' && $locale ne 'POSIX') {
177 @@ -1131,6 +1131,14 @@
178  
179  }
180  elsif ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
181
182 +if (($ml && $footers eq '')||    # no -l without -L
183 +    ($ad && $ads eq '')||        # no -a without -A
184 +    ($nohdr && $pgpshort)||      # --body and --pgp-short are like oil and water
185 +    (($nohdr||$hdrs) || ($sani||$reply))|| # no sanitizing without headers :)
186 +    ($ifile eq '')||             # no empty -i
187 +    ($ofile eq ''))              # no empty -o
188 +{ help(); }
189  
190  
191  # Read message: