summaryrefslogtreecommitdiff
path: root/build-aux/update-copyright
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-07-29 10:25:24 +0200
committerJim Meyering <meyering@redhat.com>2009-07-29 10:25:24 +0200
commit9d87a45b2fb0fcf5239227b71345a507933636c0 (patch)
treeb2c2a12e855855572a47a86b56fed1add450071e /build-aux/update-copyright
parent8aeda9b930b2b03fdd35715813f038c07bc7b429 (diff)
downloadcoreutils-9d87a45b2fb0fcf5239227b71345a507933636c0.tar.xz
maint: make update-copyright handle more cases
* build-aux/update-copyright: Handle cases in which the final year number and copyright holder are on separate lines. Prompted by a report from Joel E. Denny. Also, do not invoke localtime for each line we process.
Diffstat (limited to 'build-aux/update-copyright')
-rwxr-xr-xbuild-aux/update-copyright26
1 files changed, 15 insertions, 11 deletions
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 42579c28f..9039b7cca 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,7 @@
-#!/usr/bin/perl -w -pi
+#!/usr/bin/perl -0777 -pi
# Update an FSF copyright year list to include the current year.
-my $VERSION = '2009-06-04 08:53'; # UTC
+my $VERSION = '2009-07-29.08:18'; # UTC
# Copyright (C) 2009 Free Software Foundation
#
@@ -21,15 +21,19 @@ my $VERSION = '2009-06-04 08:53'; # UTC
# Written by Jim Meyering
use strict;
+use warnings;
-my ($sec, $min, $hour, $mday, $month, $this_year) = localtime (time());
-$this_year += 1900;
-
+my $this_year;
my $holder = 'Free Software Foundation';
-if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
+BEGIN {
+ my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
+ $this_year = $year + 1900;
+}
+
+if (/([- ])((?:\d\d)?\d\d)(\s+$holder)/s)
{
- my ($sep, $last_c_year) = ($1, $2);
+ my ($sep, $last_c_year, $rest) = ($1, $2, $3);
# Handle two-digit year numbers like "98" and "99".
$last_c_year <= 99
@@ -39,15 +43,15 @@ if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
{
if ($sep eq '-' && $last_c_year + 1 == $this_year)
{
- s//-$this_year $holder/;
+ s//-$this_year$rest/;
}
elsif ($sep eq ' ' && $last_c_year + 1 == $this_year)
{
- s// $last_c_year-$this_year $holder/;
+ s// $last_c_year-$this_year$rest/;
}
else
{
- s//$sep$last_c_year, $this_year $holder/;
+ s//$sep$last_c_year, $this_year$rest/;
}
}
}
@@ -56,7 +60,7 @@ if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
# indent-tabs-mode: nil
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "my $VERSION = '"
-# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "'; # UTC"
# End: