- # Normalize all whitespace.
- $year_lines =~ s/\s+/ /g;
-
- # Put spaces after commas.
- $year_lines =~ s/, ?/, /g;
-
- # Format within margin.
- my $year_lines_new;
- my $indent = index ($b4_copyright_line, '[');
- --$indent if ($b4_copyright_line =~ m/^\n/);
- while (length $year_lines)
- {
- my $text_margin = $margin - $indent;
- if (($year_lines =~ s/^(.{1,$text_margin})(?: |$)//)
- || ($year_lines =~ s/^([\S]+)(?: |$)//))
- {
- my $line = "\n" . (' 'x$indent) . $1;
- ++$indent if (!$year_lines_new);
- $year_lines_new .= $line;
- }
- else
- {
- # Should be unreachable, but we don't want an infinite
- # loop if it can be reached.
- die;
- }
- }
- $year_lines = $year_lines_new;
- }
+ # Replace the old invocation. Should never die.
+ die if (!s/$old_re\G/$b4_copyright_line$year_lines_new/x);