From: Joel E. Denny Date: Fri, 31 Jul 2009 13:32:30 +0000 (-0400) Subject: update-copyright: support EOL=\r\n X-Git-Tag: v0.1~5715 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=dbe9175629cc8792b496fe08cd00bbd498b33e10;p=gnulib.git update-copyright: support EOL=\r\n * build-aux/update-copyright: Implement that. --- diff --git a/ChangeLog b/ChangeLog index 9d7460244..2b2678d00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-07-31 Joel E. Denny + update-copyright: support EOL=\r\n + * build-aux/update-copyright: Implement that. + +2009-07-31 Joel E. Denny + update-copyright: automatically format copyright statements * build-aux/update-copyright: Implement that. Also, be a little more predictable and safer by always failing diff --git a/build-aux/update-copyright b/build-aux/update-copyright index 59ce6b6c6..777d3e5b9 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -107,6 +107,9 @@ my $holder = 'Free Software Foundation, Inc.'; my $prefix_max = 5; my $margin = 72; +# Unless the file consistently uses "\r\n" as the EOL, use "\n" instead. +my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n"; + my $leading; my $prefix; my $ws; @@ -164,7 +167,7 @@ if (defined($old) && /$old/) || ($new =~ s/^([\S]+)(?: |$)//)) { my $line = $1; - $new_wrapped .= $new_wrapped ? "\n" : $leading; + $new_wrapped .= $new_wrapped ? $eol : $leading; $new_wrapped .= "$prefix$line"; } else