# HG changeset patch # User Chetan Kapoor # Date 1254845372 -3600 # Node ID d22c49c5048f454f1aa9e097fe342ce275fe5d18 # Parent ce6215be051a7979e8349c32920136e8896fbd7f Fixed "white-spaces" in licence text issue in convert_to_eula.pl diff -r ce6215be051a -r d22c49c5048f williamr/convert_to_eula.pl --- a/williamr/convert_to_eula.pl Wed Sep 23 17:41:26 2009 +0100 +++ b/williamr/convert_to_eula.pl Tue Oct 06 17:09:32 2009 +0100 @@ -58,15 +58,28 @@ push @newlines, $line; next; } - my $midline = shift @lines; - my $urlline = shift @lines; + my @midlines = (); + my $nextline; + my $midlinecount = 1; + while ($nextline = shift @lines) + { + if ($nextline !~ /^\s$/) + { + # non-blank line + last if ($midlinecount == 0); + $midlinecount -= 1; + # keep going + } + push @midlines, $nextline; + } + my $urlline = $nextline; my $pos2 = index $urlline, $oldtext[1]; if ($pos2 >= 0) { # Found it - assume that there's only one instance substr $line, $pos1, length($oldtext[0]), $newtext[0]; substr $urlline, $pos2, length($oldtext[1]), $newtext[1]; - push @newlines, $line, $midline, $urlline; + push @newlines, $line, @midlines, $urlline; $updated += 1; next; } @@ -75,7 +88,7 @@ if(!$updated) { my $lineno = 1 + (scalar @newlines); - print STDERR "Problem in $file at $lineno: incorrectly formatted >\n$line$midline$urlline\n"; + print STDERR "Problem in $file at $lineno: incorrectly formatted >\n$line", join("",@midlines), "$urlline\n"; push @errorfiles, $file; } last;