* src/tools/update-copyright-year: Fix single-year entry handling.

This commit is contained in:
Werner Lemberg 2021-01-17 08:44:00 +01:00
parent b6e8a71266
commit d35c7f7cba
2 changed files with 18 additions and 14 deletions

View File

@ -1,3 +1,7 @@
2021-01-17 Werner Lemberg <wl@gnu.org>
* src/tools/update-copyright-year: Fix single-year entry handling.
2021-01-16 Alexei Podtelezhnikov <apodtele@gmail.com> 2021-01-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/unix/unixddef.mk: Remove the second DEVEL_DIR definition. * builds/unix/unixddef.mk: Remove the second DEVEL_DIR definition.

View File

@ -28,20 +28,20 @@ eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}'
# #
# or # or
# #
# /* Copyright 2000, 2001, 2004-2007 by */ # /* Copyright (c) 2000, 2001, 2004-2007 by */
# /* foobar */ # /* foobar */
# #
# and replaces them uniformly with # and replaces them uniformly with
# #
# Copyright 2000-2015 # Copyright (C) 2000-2021
# foobar # foobar
# #
# and # and
# #
# /* Copyright 2000-2015 by */ # /* Copyright (C) 2000-2021 by */
# /* foobar */ # /* foobar */
# #
# (assuming that the current year is 2015). As can be seen, the line length # (assuming that the current year is 2021). As can be seen, the line length
# is retained if there is non-whitespace after the word `by' on the same # is retained if there is non-whitespace after the word `by' on the same
# line. # line.
@ -80,11 +80,11 @@ while (<>)
{ {
# Fill line to the same length (if appropriate); we skip the middle # Fill line to the same length (if appropriate); we skip the middle
# part but insert `(C)', three spaces, and `-'. # part but insert `(C)', three spaces, and `-'.
my $space = length($+{space1}) - 1 my $space = length($+{space1})
+ length($+{middle}) - 1 + length($+{middle})
+ length($+{space2}) - 1 + length($+{space2})
+ length($+{space3}) + length($+{space3})
- (length("(C)") + 1); - (length("(C)") + 3 + 1);
print "$+{begin}"; print "$+{begin}";
print "Copyright\ (C)\ $+{first}-$year\ by"; print "Copyright\ (C)\ $+{first}-$year\ by";
@ -107,11 +107,11 @@ while (<>)
} }
{ {
# Fill line to the same length (if appropriate); we insert three # Fill line to the same length (if appropriate); we insert three
# spaces, a `-', and the current year. # spaces, the string `(C)', a `-', and the current year.
my $space = length($+{space1}) - 1 my $space = length($+{space1})
+ length($+{space2}) - 1 + length($+{space2})
+ length($+{space3}) + length($+{space3})
- (length($year) + 1); - (length($year) + length("(C)") + 3 + 1);
print "$+{begin}"; print "$+{begin}";
print "Copyright\ (C)\ $+{first}-$year\ by"; print "Copyright\ (C)\ $+{first}-$year\ by";