1 eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}'
2 & eval 'exec perl -wS -i "$0" $argv:q'
5 # Copyright (C) 2015-2023 by
8 # This file is part of the FreeType project, and may only be used, modified,
9 # and distributed under the terms of the FreeType project license,
10 # LICENSE.TXT. By continuing to use, modify, or distribute this file you
11 # indicate that you have read the license and understand and accept it
14 # [Note: This script is expected to be called by the shell, which in turn
15 # calls perl automatically. The nifty start-up code above is based on
16 # gnulib's `update-copyright' script; it is a more portable replacement for
17 # the shebang, using the first `perl' program in the shell's path instead.]
21 # update-copyright-year file1 [file2 ...]
24 # This script handles copyright entries like
31 # /* Copyright (c) 2000, 2001, 2004-2007 by */
34 # and replaces them uniformly with
36 # Copyright (C) 2000-2021
41 # /* Copyright (C) 2000-2021 by */
44 # (assuming that the current year is 2021). As can be seen, the line length
45 # is retained if there is non-whitespace after the word `by' on the same
51 my (undef, undef, undef,
53 undef, undef, undef) = localtime(time);
59 # Loop over all input files; option `-i' (issued at the very beginning of
60 # this script) makes perl edit them in-place.
63 # Only handle the first copyright notice in a file.
66 # First try: Search multiple copyright years.
72 (?<first>[12][0-9][0-9][0-9])
74 (?<last>[12][0-9][0-9][0-9])
81 # Fill line to the same length (if appropriate); we skip the middle
82 # part but insert `(C)', three spaces, and `-'.
83 my $space = length($+{space1})
87 - (length("(C)") + 3 + 1);
90 print "Copyright\ (C)\ $+{first}-$year\ by";
91 print ' ' x $space if length($+{end});
96 # Second try: Search a single copyright year.
102 (?<first>[12][0-9][0-9][0-9])
109 if ($+{first} < $year)
111 # Fill line to the same length (if appropriate); we insert three
112 # spaces, the string `(C)', a `-', and the current year.
113 my $space = length($+{space1})
116 - (length($year) + length("(C)") + 3 + 1);
119 print "Copyright\ (C)\ $+{first}-$year\ by";
120 # If $space is negative this inserts nothing.
121 print ' ' x $space if length($+{end});
127 # Fill line to the same length (if appropriate); we insert three
128 # spaces and the string `(C)'.
129 my $space = length($+{space1})
132 - (length("(C)") + 3);
135 print "Copyright\ (C)\ $+{first}\ by";
136 # If $space is negative this inserts nothing.
137 print ' ' x $space if length($+{end});
143 # Otherwise print line unaltered.
153 # Reset $replaced before processing the next file.
154 $replaced = 0 if eof;