]> git.deb.at Git - pkg/t-prot.git/blob - contrib/t-prot-r1.267-gol.diff
Imported Upstream version 2.10
[pkg/t-prot.git] / contrib / t-prot-r1.267-gol.diff
1 --- t-prot      2009-12-30 22:34:16.000000000 +0100
2 +++ t-prot-gol  2009-12-30 22:35:36.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.10';
10  use constant REV            => '';
11  use constant REL            => q$Revision: 1.267 $=~m/(\d+(?:\.\d+)+)/;
12 @@ -915,83 +915,82 @@
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]+)(?:,(\S+))?$/$2/) {
39 -            my $foo = $1;
40 +if (!Getopt::Long::GetOptions(
41 +    'a'             => \$ad,
42 +    'A=s'           => \$ads,
43 +    'bigq:s'        => \$_t1,
44 +    'c'             => \$cr,
45 +    'check:s'       => \$_t9,
46 +    'debug|d'       => \$sysl,
47 +    'diff'          => \$diff,
48 +    'e'             => \$elli,
49 +    'ftr-ad'        => \$ftr_ad,
50 +    'ftr-ml'        => \$ftr_ml,
51 +    'groupwise'     => \$gw,
52 +    'help|h'        => \$_t2,
53 +    'i=s'           => \$ifile,
54 +    'k'             => \$kamm,
55 +    'kminl=i'       => \$_t3,
56 +    'kmaxl=i'       => \$_t4,
57 +    'kdiff=i'       => \$_t5,
58 +    'L=s'           => \$footers,
59 +    'l'             => \$ml,
60 +    'lax-security'  => \$lax,
61 +    'locale=s'      => \$locale,
62 +    'max-lines=i'   => \$maxlines,
63 +    'ms-smart'      => \$ms_smart,
64 +    'mua|M=s'       => \$_t7,
65 +    'm'             => \$ms,
66 +    'o=s'           => \$ofile,
67 +    'P=s'           => \$boun,
68 +    'p:s'           => \$_t8,
69 +    'pgp-short'     => \$pgpshort,
70 +    'pgp-move'      => \$pgpmove,
71 +    'pgp-move-vrf'  => \$pgpmovevrf,
72 +    'r'             => \$hdrs,
73 +    'S:i'           => \$_t6,
74 +    's'             => \$sig,
75 +    'sigsmax:i'     => \$_ta,
76 +    'spass'         => \$spass,
77 +    't'             => \$trad,
78 +    'version|v'     => \$_tb,
79 +    'w'             => \$trsp
80 +    )) {
81 +    help();
82 +}
83  
84 -            if ($foo =~ /^ratio=(0?\.\d+)$/) {
85 -                $check_ratio = $1?$1:1;
86 -            }
87 -        }
88 +# clean up temp vals:
89 +if (defined $_t1) {
90 +    if ($_t1 !~ /^(?:(\d+)(?:,(\d+))?)?$/) { help(); }
91 +    $bigqn = $1?$1:30; 
92 +    $bigqx = $2?$2:10; 
93 +    if ($bigqn<=0 || $bigqx<=0 || $bigqn<=$bigqx) { help(); }
94 +}
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; }
100 +if (defined $_t7) {
101 +    $mua = lc($_t7);
102 +    # mutt still displays the message when ^C'ing pgp verification:
103 +    if ($mua eq 'mutt') { $SIG{'INT'} = 'sigint_handler'; }
104 +}
105 +if (defined $_t8) { $mda = $_t8 ? $_t8 : '1'; }
106 +if (defined $_t9) {
107 +    $check = 1;
108 +    while ($_t9 && $_t9 =~ s/^([^,\s]+)(?:,(\S+))?$/$2/) {
109 +        my $foo = $1;
110 +        if ($foo =~ /^ratio=(0?\.\d+)$/) { $check_ratio = $1?$1:1; }
111      }
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') {
131 -        $mua = lc($val);
132 -
133 -        if ($mua eq 'mutt') {
134 -            # mutt still displays the message when ^C'ing pgp verification:
135 -            $SIG{'INT'} = 'sigint_handler';
136 -        }
137 -    }
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; }
152 -    else                    { help(); }
153  }
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
160 -{ help(); }
161 -
162 +if (defined $_ta) { $sign = $_ta ? $_ta : undef; }
163 +if (defined $_tb) { version(); }
164 +if ($ms_smart) { $ms = 1; }
165  
166  if ($mua eq 'mutt') {
167      if (defined $locale && $locale ne '' && $locale ne 'C' && $locale ne 'POSIX') {
168 @@ -1053,11 +1052,15 @@
169                  m/^([^%]*)/;
170          }
171      }
172 -
173 -}
174 -else {
175 -    if ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
176  }
177 +elsif ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
178 +
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
184 +{ help(); }
185  
186  
187  # Read message: