Update Gnulib to the latest git version
[deliverable/binutils-gdb.git] / gnulib / import / extra / update-copyright
index 17ee6b14d1155e2185756bdb3b79de43ef6c3af2..e4809f620d632bcf6d02f03a6c1fade5ad73b2a7 100755 (executable)
@@ -1,11 +1,9 @@
-eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" "$@"'
-  & eval 'exec perl -wS -0777 -pi "$0" $argv:q'
-    if 0;
-# Update an FSF copyright year list to include the current year.
+#!/bin/sh
+#! -*-perl-*-
 
-my $VERSION = '2016-01-12.23:13'; # UTC
+# Update an FSF copyright year list to include the current year.
 
-# Copyright (C) 2009-2016 Free Software Foundation, Inc.
+# Copyright (C) 2009-2019 Free Software Foundation, Inc.
 #
 # 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
@@ -18,10 +16,13 @@ my $VERSION = '2016-01-12.23:13'; # UTC
 # 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/>.
-
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+#
 # Written by Jim Meyering and Joel E. Denny
 
+# This script updates an FSF copyright year list to include the current year.
+# Usage: update-copyright [FILE...]
+#
 # The arguments to this script should be names of files that contain
 # copyright statements to be updated.  The copyright holder's name
 # defaults to "Free Software Foundation, Inc." but may be changed to
@@ -81,6 +82,7 @@ my $VERSION = '2016-01-12.23:13'; # UTC
 #        B. (c)
 #        C. @copyright{}
 #        D. &copy;
+#        E. ©
 #
 #   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
@@ -96,7 +98,7 @@ my $VERSION = '2016-01-12.23:13'; # UTC
 #   6. Blank lines, even if preceded by the prefix, do not appear
 #      within the FSF copyright statement.
 #   7. Each copyright year is 2 or 4 digits, and years are separated by
-#      commas or dashes.  Whitespace may appear after commas.
+#      commas, "-", or "--".  Whitespace may appear after commas.
 #
 # Environment variables:
 #
@@ -120,11 +122,32 @@ my $VERSION = '2016-01-12.23:13'; # UTC
 #   5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
 #      than "Free Software Foundation, Inc.".
 
+# This is a prologue that allows to run a perl script as an executable
+# on systems that are compliant to a POSIX version before POSIX:2017.
+# On such systems, the usual invocation of an executable through execlp()
+# or execvp() fails with ENOEXEC if it is a script that does not start
+# with a #! line.  The script interpreter mentioned in the #! line has
+# to be /bin/sh, because on GuixSD systems that is the only program that
+# has a fixed file name.  The second line is essential for perl and is
+# also useful for editing this file in Emacs.  The next two lines below
+# are valid code in both sh and perl.  When executed by sh, they re-execute
+# the script through the perl program found in $PATH.  The '-x' option
+# is essential as well; without it, perl would re-execute the script
+# through /bin/sh.  When executed by  perl, the next two lines are a no-op.
+eval 'exec perl -wSx -0777 -pi "$0" "$@"'
+     if 0;
+
+my $VERSION = '2018-03-07.03:47'; # UTC
+# The definition above must lie within the first 8 lines in order
+# for the Emacs time-stamp write hook (at end) to update it.
+# If you change this file with Emacs, please let the write hook
+# do its job.  Otherwise, update this string manually.
+
 use strict;
 use warnings;
 
 my $copyright_re = 'Copyright';
-my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|&copy;)';
+my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|&copy;)';
 my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
 $holder ||= 'Free Software Foundation, Inc.';
 my $prefix_max = 5;
@@ -169,7 +192,7 @@ while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
     $holder_re =~ s/\s/$ws_re/g;
     my $stmt_remainder_re =
       "(?:$ws_re$circle_c_re)?"
-      . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|-))*"
+      . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|--?))*"
       . "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
     if (/\G$stmt_remainder_re/)
       {
@@ -208,26 +231,28 @@ if (defined $stmt_re)
         # Make the use of intervals consistent.
         if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS})
           {
-            $stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg;
+            $stmt =~ s/(\d{4})--?(\d{4})/join(', ', $1..$2)/eg;
           }
         else
           {
+            my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-";
+
             $stmt =~
               s/
                 (\d{4})
                 (?:
-                  (,\ |-)
+                  (,\ |--?)
                   ((??{
-                    if    ($2 eq '-') { '\d{4}'; }
+                    if   ($2 ne ', ') { '\d{4}'; }
                     elsif (!$3)       { $1 + 1;  }
                     else              { $3 + 1;  }
                   }))
                 )+
-              /$1-$3/gx;
+              /$1$ndash$3/gx;
 
             # When it's 2, emit a single range encompassing all year numbers.
             $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
-              and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/;
+              and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1$ndash$2/;
           }
 
         # Format within margin.
@@ -263,10 +288,13 @@ else
     print STDERR "$ARGV: warning: copyright statement not found\n";
   }
 
+# Hey Emacs!
 # Local variables:
+# coding: utf-8
 # mode: perl
 # indent-tabs-mode: nil
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-line-limit: 200
 # time-stamp-start: "my $VERSION = '"
 # time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
 # time-stamp-time-zone: "UTC0"
This page took 0.026287 seconds and 4 git commands to generate.