#!/usr/bin/perl -0777 -pi
# Update an FSF copyright year list to include the current year.
-my $VERSION = '2009-08-05.20:47'; # UTC
+my $VERSION = '2009-08-06.01:08'; # UTC
# Copyright (C) 2009 Free Software Foundation, Inc.
#
# The exact conditions that a file's FSF copyright statement must meet
# to be recognized are:
#
-# 1. The format is "Copyright (C)" (where "(C)" can also be "(c)",
-# "@copyright{}", or "©"), then a list of copyright years, and
-# then the name of the copyright holder, which is "Free Software
-# Foundation, Inc.".
-# 2. The "Copyright (C)" appears at the beginning of a line except
-# that it may be prefixed by any sequence (e.g., a comment) of no
-# more than 5 characters.
-# 3. Iff such a prefix is present, the same prefix appears at the
+# 1. It is the first FSF copyright statement that meets all of the
+# following conditions. Subsequent FSF copyright statements are
+# ignored.
+# 2. Its format is "Copyright (C)", then a list of copyright years,
+# and then the name of the copyright holder, which is "Free
+# Software Foundation, Inc.".
+# 3. The "(C)" takes one of the following forms or is omitted
+# entirely:
+#
+# A. (C)
+# B. (c)
+# C. @copyright{}
+# D. ©
+#
+# 4. The "Copyright" appears at the beginning of a line except that it
+# may be prefixed by any sequence (e.g., a comment) of no more than
+# 5 characters.
+# 5. Iff such a prefix is present, the same prefix appears at the
# beginning of each remaining line within the FSF copyright
# statement.
-# 4. Blank lines, even if preceded by the prefix, do not appear
+# 6. Blank lines, even if preceded by the prefix, do not appear
# within the FSF copyright statement.
-# 5. Each copyright year is 2 or 4 digits, and years are separated by
+# 7. Each copyright year is 2 or 4 digits, and years are separated by
# commas or dashes. Whitespace may occur after commas.
-# 6. It is the first FSF copyright statement that meets all of the
-# above conditions. Subsequent FSF copyright statements are
-# ignored.
use strict;
use warnings;
-my $copyright_re = 'Copyright (?:\([cC]\)|@copyright{}|©)';
+my $copyright_re = 'Copyright';
+my $circle_c_re = '(?:\([cC]\)|@copyright{}|©)';
my $holder = 'Free Software Foundation, Inc.';
my $prefix_max = 5;
my $margin = 72;
my $holder_re = $holder;
$holder_re =~ s/\s/$ws_re/g;
my $stmt_remainder_re =
- "$ws_re(?:(?:\\d\\d)?\\d\\d(,$ws_re?|-))*"
+ "(?:$ws_re$circle_c_re)?"
+ . "$ws_re(?:(?:\\d\\d)?\\d\\d(,$ws_re?|-))*"
. "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
if (/\G$stmt_remainder_re/)
{
$stmt_re =
- quotemeta("$leading$prefix")
- . "($copyright_re$stmt_remainder_re)";
+ quotemeta("$leading$prefix")
+ . "($copyright_re$stmt_remainder_re)";
last;
}
}
compare $TMP-exp $TMP || exit 1
rm $TMP*
+## --------------- ##
+## Omitted "(C)". ##
+## --------------- ##
+
+TMP=$TMP_BASE-omitted-circle-c
+cat > $TMP <<EOF
+ Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+ 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+ 2009 Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+ update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+ Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98, 1999,
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009-2010 Free
+ Software Foundation, Inc.
+EOF
+rm $TMP*
+
exit 0