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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
#!/usr/bin/perl -0777 -pi
# Update an FSF copyright year list to include the current year.
my $VERSION = '2009-07-30.13:24'; # UTC
# Copyright (C) 2009 Free Software Foundation
#
# This program 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 3, or (at your option)
# any later version.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
# Written by Jim Meyering
# In the copyright statement in each file, "Copyright (C)" must appear
# at the beginning of the line except that it may be preceded by any
# sequence (e.g., a comment) of no more than 5 characters. Iff that
# prefix is present, the same prefix should appear at the beginning
# of each remaining line within the copyright statement so that it
# can be parsed correctly.
#
# For example, these are fine:
#
# # Copyright (C) 1990-2005, 2007-2009 Free Software
# # Foundation, Inc.
#
# /*
# * Copyright (C) 1990-2005, 2007-2009 Free Software
# * Foundation, Inc.
# */
#
# The following format is not recognized:
#
# /* Copyright (C) 1990-2005, 2007-2009 Free Software
# * Foundation, Inc. */
#
# A warning is printed for every file for which the copyright format is
# not recognized. The culprit may be that the above preconditions are
# not obeyed as in the previous example, or it may simply be that the
# stated copyright holder is not the Free Software Foundation.
#
# You may wish to place a target like the following in your top-level
# makefile in your project:
#
# .PHONY: update-copyright
# update-copyright:
# if test -d .git; then \
# git grep -l -w Copyright \
# | grep -v -E '(^|/)(COPYING|ChangeLog)' \
# | xargs $(srcdir)/build-aux/$@; \
# fi
#
# You can build a list of files to skip in the second grep.
use strict;
use warnings;
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
my $this_year = $year + 1900;
my $holder = 'Free Software Foundation';
my $prefix = '';
if (/(?:^|\n)(.{0,5})Copyright \([cC]\)/) {
$prefix = quotemeta $1;
}
$holder = " $holder";
$holder =~ s/\s/\\s*(?:\\s|\\n$prefix)\\s*/g;
if (/([- ])((?:\d\d)?\d\d)($holder)/s)
{
my ($sep, $last_c_year, $rest) = ($1, $2, $3);
# Handle two-digit year numbers like "98" and "99".
$last_c_year <= 99
and $last_c_year += 1900;
if ($last_c_year != $this_year)
{
if ($sep eq '-' && $last_c_year + 1 == $this_year)
{
s//-$this_year$rest/;
}
elsif ($sep eq ' ' && $last_c_year + 1 == $this_year)
{
s// $last_c_year-$this_year$rest/;
}
else
{
s//$sep$last_c_year, $this_year$rest/;
}
}
}
else
{
print STDERR
"$ARGV: warning: external copyright holder or parse failure\n";
}
# Local variables:
# indent-tabs-mode: nil
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "my $VERSION = '"
# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "'; # UTC"
# End:
|