1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 11:16:16 +02:00
Files
coreutils/build-aux/update-copyright
Jim Meyering e40c5f735c maint: make update-copyright work in yet another case
* build-aux/update-copyright: Handle the case in which "\n#"
appears between the final year number and the copyright holder name.
* m4/lib-check.m4: Update copyright year list.
Reported by Joel E. Denny.
2009-07-29 15:39:25 +02:00

63 lines
1.8 KiB
Perl
Executable File

#!/usr/bin/perl -0777 -pi
# Update an FSF copyright year list to include the current year.
my $VERSION = '2009-07-29.13:34'; # 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
use strict;
use warnings;
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
my $this_year = $year + 1900;
my $holder = 'Free Software Foundation';
if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$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/;
}
}
}
# 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: