blob: 88bbb6959cbacc62de24d5a49d1138709f0f3319 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/usr/bin/perl
use Getopt::Long;
sub usage {
print STDERR "Usage:\n";
print STDERR "\t$0 --lic2 <license 2.0 file>\n";
exit 1;
}
&usage unless GetOptions("lic2=s" => \$lic2);
&usage unless defined($lic2);
die "Can't open $lic2\n" unless open LIC2, "<$lic2";
# Read files without an input record separator
undef $/;
# Slurp the license file
$lic2text = <LIC2>;
($lic2begin = $lic2text) =~ s/^(.*)\{YEARS\}(.*)/$1/s;
$lic2rem = $2;
# Slurp the input file
$_ = <>;
s|[^\n]*=+\s+ # Non-newlines followed by multiple '='
# ...followed by whitespace (incl. newline)
[^\n]* # Non-newlines (incl spaces)
The\ Apache\ Software\ License,\ Version\ 1\.1
[^C]* # Anything not a capital C
Copyright\ \(C\)\ (\d+(-\d+)?)\ The\ Apache\ Software\ Foundation
.* # Anything
Foundation,\ please\ see\ \<http://www.apache.org/\>\.
\s*\n # Any whitespace ending in a newline
|$lic2begin$1$lic2rem|xs;
print;
|