]> git.deb.at Git - pkg/t-prot.git/blob - contrib/t-prot-r1.51-ftr.diff
a11af292b0cc523c54b3f7b76602a8c223e8a832
[pkg/t-prot.git] / contrib / t-prot-r1.51-ftr.diff
1 --- t-prot-x    2002-03-25 02:15:50.000000000 +0100
2 +++ t-prot      2002-03-25 03:24:03.000000000 +0100
3 @@ -14,7 +14,7 @@
4  
5  # Version info
6  $VER                   = '0.54';
7 -$REV                   = '';
8 +$REV                   = '-ftr';
9  $REL                   = q$Revision: 1.51 $; chop($REL);
10  # From <sysexits.h>
11  # (you might have to adjust those if not using GNU libc)
12 @@ -75,6 +75,7 @@
13         my $S = shift;          # array to store removed lines in
14         my $F = shift;          # footers dir name
15         my $O = shift;          # remove only one footer?
16 +       my $V = shift;          # allow footers match before end of message
17  
18         if ($F && scalar(@$L)) {
19             opendir(DIR, $F) || die "Could not open $F: $!";
20 @@ -85,25 +86,27 @@
21                 open(IN, "$F/$f") || die "Could not open $F/$f: $!";
22                 my @l = <IN>;
23             close IN;
24 +                       for (my $z=0; $z<=$#l; $z++) { chomp($l[$z]); }
25  
26 -               while (scalar(@l)<=scalar(@$L)) {
27 -               my $y = 0;
28 -                   for(my $x=1; $x<=scalar(@l); $x++) {
29 -                   chomp($l[scalar(@l)-$x]);
30 -                       if (index($$L[scalar(@$L)-$x], $l[scalar(@l)-$x])!=0) { 
31 -                                               $y = 1; 
32 -                                       }
33 -                   }
34 -               if (!$y) {
35 -                                       unshift(@$S, @$L[$#$L-$#l..$#$L]);
36 -                                       splice(@$L, $#$L-$#l);
37 -                                       while (scalar(@$L) && $$L[$#$L] =~ /^\s*$/) {
38 -                       unshift(@$S, pop(@$L));
39 -                                       }
40 -                                       if ($O) { last; }
41 -                   }
42 -                               else { last; }
43 -               }
44 +                       WIPE: for (my $z=$V?(scalar(@$L)-scalar(@l)):0; $z>=0; $z--)
45 +                       {
46 +                       if (scalar(@l)+$z<=scalar(@$L)) {
47 +                       my $y = 0;
48 +                       for(my $x=1; $x<=scalar(@l); $x++) {
49 +                           if (index($$L[scalar(@$L)-$x-$z], $l[scalar(@l)-$x])!=0) { 
50 +                                                       $y = 1; 
51 +                                               }
52 +                           }
53 +                       if (!$y) {
54 +                                               unshift(@$S, @$L[$#$L-$#l-$z..$#$L]);
55 +                                               splice(@$L, $#$L-$#l-$z);
56 +                                               while (scalar(@$L) && $$L[$#$L] =~ /^\s*$/) {
57 +                               unshift(@$S, pop(@$L));
58 +                                               }
59 +                                               if ($O) { last; } else { goto WIPE; }
60 +                           }
61 +                       }
62 +                       }
63             }
64         }
65  }
66 @@ -269,10 +272,10 @@
67         }
68  
69         # Remove ML footers:
70 -       remove_footers($lines, \@ftr, $footers, undef);
71 +       remove_footers($lines, \@ftr, $footers, undef, undef);
72  
73         # Remove ad footers:
74 -       remove_footers($lines, \@ads, $ads, undef);
75 +       remove_footers($lines, \@ads, $ads, undef, '1');
76  
77         # Remove signature:
78         if (scalar(@$lines)) {