# HG changeset patch # User Joel E. Denny # Date 1249047150 14400 # Node ID 392f877029a8d502c9c5d3e7f7786436ea01d387 # Parent 064d47cfb04ef03c52332bb61cb47b47a958bdf4 update-copyright: support EOL=\r\n * build-aux/update-copyright: Implement that. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/build-aux/update-copyright b/build-aux/update-copyright --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -107,6 +107,9 @@ 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 @@ || ($new =~ s/^([\S]+)(?: |$)//)) { my $line = $1; - $new_wrapped .= $new_wrapped ? "\n" : $leading; + $new_wrapped .= $new_wrapped ? $eol : $leading; $new_wrapped .= "$prefix$line"; } else