Mercurial > hg > octave-nkf > gnulib-hg
changeset 11772:392f877029a8
update-copyright: support EOL=\r\n
* build-aux/update-copyright: Implement that.
author | Joel E. Denny <jdenny@clemson.edu> |
---|---|
date | Fri, 31 Jul 2009 09:32:30 -0400 |
parents | 064d47cfb04e |
children | 803d728925f9 |
files | ChangeLog build-aux/update-copyright |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-07-31 Joel E. Denny <jdenny@clemson.edu> + + update-copyright: support EOL=\r\n + * build-aux/update-copyright: Implement that. + 2009-07-31 Joel E. Denny <jdenny@clemson.edu> update-copyright: automatically format copyright statements
--- 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