forked from gtk-gnutella/gtk-gnutella
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix_copyright.pl
executable file
·60 lines (54 loc) · 1.63 KB
/
fix_copyright.pl
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/perl
eval 'exec perl5 -S $0 ${1+"$@"}'
if $running_under_some_shell;
#
# $Id$
#
# Copyright (c) 2003, Raphael Manfredi
#
# Fix copyright of source files, in place, by extending the year range
# if needed for lines bearing the copyright of active developers.
#
#----------------------------------------------------------------------
# This file is part of gtk-gnutella.
#
# gtk-gnutella is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# gtk-gnutella is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gtk-gnutella; if not, write to the Free Software
# Foundation, Inc.:
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#----------------------------------------------------------------------
#
my @DEVS = (
"Raphael Manfredi",
"Jeroen Asselman",
);
my $COPYRIGHT = "Copyright \\(c\\)";
$^I = '';
my $year = 1900 + (localtime(time))[5];
while (<>) {
my $found = 0;
if (/$COPYRIGHT/o) {
foreach my $dev (@DEVS) {
$found++ if /$dev/;
last if $found;
}
}
if ($found) {
if (/$COPYRIGHT (\d+),/o) {
s/^(.*?$COPYRIGHT \d+),/$1-$year,/o if $year > $1;
} elsif (/$COPYRIGHT \d+-(\d+),/o) {
s/^(.*?$COPYRIGHT \d+)-\d+,/$1-$year,/o if $year > $1;
}
}
print;
}