From dbe9175629cc8792b496fe08cd00bbd498b33e10 Mon Sep 17 00:00:00 2001 From: "Joel E. Denny" Date: Fri, 31 Jul 2009 09:32:30 -0400 Subject: [PATCH] update-copyright: support EOL=\r\n * build-aux/update-copyright: Implement that. --- ChangeLog | 5 +++++ build-aux/update-copyright | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 -- 2.11.0