]> git.deb.at Git - pkg/t-prot.git/blob - contrib/t-prot-r1.269-gol.diff
Imported Upstream version 2.11
[pkg/t-prot.git] / contrib / t-prot-r1.269-gol.diff
1 --- t-prot      2010-01-05 13:03:01.000000000 +0100
2 +++ t-prot-gol  2010-01-05 13:04:08.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.11';
10  use constant REV            => '';
11  use constant REL            => q$Revision: 1.268 $=~m/(\d+(?:\.\d+)+)/;
12 @@ -914,84 +914,83 @@
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
15  
16 +# temp vals:
17 +my ($_t1, $_t2, $_t3, $_t4, $_t5, $_t6, $_t7, $_t8, $_t9, $_ta, $_tb) = 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 sigsmax:i spass'.
24 -    ' 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 +if (!Getopt::Long::GetOptions(
42 +    'a'             => \$ad,
43 +    'A=s'           => \$ads,
44 +    'bigq:s'        => \$_t1,
45 +    'c'             => \$cr,
46 +    'check:s'       => \$_t9,
47 +    'debug|d'       => \$sysl,
48 +    'diff'          => \$diff,
49 +    'e'             => \$elli,
50 +    'ftr-ad'        => \$ftr_ad,
51 +    'ftr-ml'        => \$ftr_ml,
52 +    'groupwise'     => \$gw,
53 +    'help|h'        => \$_t2,
54 +    'i=s'           => \$ifile,
55 +    'k'             => \$kamm,
56 +    'kminl=i'       => \$_t3,
57 +    'kmaxl=i'       => \$_t4,
58 +    'kdiff=i'       => \$_t5,
59 +    'L=s'           => \$footers,
60 +    'l'             => \$ml,
61 +    'lax-security'  => \$lax,
62 +    'locale=s'      => \$locale,
63 +    'max-lines=i'   => \$maxlines,
64 +    'ms-smart'      => \$ms_smart,
65 +    'mua|M=s'       => \$_t7,
66 +    'm'             => \$ms,
67 +    'o=s'           => \$ofile,
68 +    'P=s'           => \$boun,
69 +    'p:s'           => \$_t8,
70 +    'pgp-short'     => \$pgpshort,
71 +    'pgp-move'      => \$pgpmove,
72 +    'pgp-move-vrf'  => \$pgpmovevrf,
73 +    'r'             => \$hdrs,
74 +    'S:i'           => \$_t6,
75 +    's'             => \$sig,
76 +    'sigsmax:i'     => \$_ta,
77 +    'spass'         => \$spass,
78 +    't'             => \$trad,
79 +    'version|v'     => \$_tb,
80 +    'w'             => \$trsp
81 +    )) {
82 +    help();
83 +}
84  
85 -            if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) {
86 -                $check_ratio = $1?$1:0.75;
87 -            }
88 -        }
89 +# clean up temp vals:
90 +if (defined $_t1) {
91 +    if ($_t1 !~ /^(?:(\d+)(?:,(\d+))?)?$/) { help(); }
92 +    $bigqn = $1?$1:30; 
93 +    $bigqx = $2?$2:10; 
94 +    if ($bigqn<=0 || $bigqx<=0 || $bigqn<=$bigqx) { help(); }
95 +}
96 +if (defined $_t2) { help(); }
97 +if (defined $_t3) { $kminl = $_t3; $kamm = 1; }
98 +if (defined $_t4) { $kmaxl = $_t4; $kamm = 1; }
99 +if (defined $_t5) { $kdiff = $_t5; $kamm = 1; }
100 +if (defined $_t6) { $lsig = $_t6 ? $_t6 : $maxsig; }
101 +if (defined $_t7) {
102 +    $mua = lc($_t7);
103 +    # mutt still displays the message when ^C'ing pgp verification:
104 +    if ($mua eq 'mutt') { $SIG{'INT'} = 'sigint_handler'; }
105 +}
106 +if (defined $_t8) { $mda = $_t8 ? $_t8 : '1'; }
107 +if (defined $_t9) {
108 +    $check = 1;
109 +    while ($_t9 && $_t9 =~ /^([^,\s]+)(?:,(\S+))?$/) {
110 +        my $foo = $1;
111 +        $_t9 = $2;
112 +        if ($foo =~ /^ratio(?:=(0?\.\d+))?$/) { $check_ratio = $1?$1:0.75; }
113      }
114 -    elsif ($opt eq 'd')     { $sysl = 1; }
115 -    elsif ($opt eq 'diff')  { $diff = 1; }
116 -    elsif ($opt eq 'e')     { $elli = 1; }
117 -    elsif ($opt eq 'ftr-ad') { $ftr_ad = 1; $ad = 1; }
118 -    elsif ($opt eq 'ftr-ml') { $ftr_ml = 1; $ml = 1; }
119 -    elsif ($opt eq 'groupwise') { $gw = 1; }
120 -    elsif ($opt eq 'i')     { $ifile = $val; }
121 -    elsif ($opt eq 'k')     { $kamm = 1; }
122 -    elsif ($opt eq 'kminl') { $kminl = $val; $kamm = 1; }
123 -    elsif ($opt eq 'kmaxl') { $kmaxl = $val; $kamm = 1; }
124 -    elsif ($opt eq 'kdiff') { $kdiff = $val; $kamm = 1; }
125 -    elsif ($opt eq 'L')     { $footers = $val; }
126 -    elsif ($opt eq 'l')     { $ml = 1; }
127 -    elsif ($opt eq 'lax-security') { $lax = 1; }
128 -    elsif ($opt eq 'locale') { $locale = $val; }
129 -    elsif ($opt eq 'm')     { $ms = 1; }
130 -    elsif ($opt eq 'max-lines') { $maxlines = $val; }
131 -    elsif ($opt eq 'ms-smart') { $ms_smart = 1; $ms = 1; }
132 -    elsif ($opt eq 'M') {
133 -        $mua = lc($val);
134 -
135 -        if ($mua eq 'mutt') {
136 -            # mutt still displays the message when ^C'ing pgp verification:
137 -            $SIG{'INT'} = 'sigint_handler';
138 -        }
139 -    }
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; }
154 -    else                    { help(); }
155  }
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
162 -{ help(); }
163 -
164 +if (defined $_ta) { $sign = $_ta ? $_ta : undef; }
165 +if (defined $_tb) { version(); }
166 +if ($ms_smart) { $ms = 1; }
167  
168  if ($mua eq 'mutt') {
169      if (defined $locale && $locale ne '' && $locale ne 'C' && $locale ne 'POSIX') {
170 @@ -1053,11 +1052,15 @@
171                  m/^([^%]*)/;
172          }
173      }
174 -
175 -}
176 -else {
177 -    if ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
178  }
179 +elsif ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
180 +
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
186 +{ help(); }
187  
188  
189  # Read message: