1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-26 02:46:13 -04:00

Don't remove all blank lines. Just the first of a comment block.

This commit is contained in:
Russ Rowan 2006-01-08 12:56:15 -05:00
parent 67a89e1454
commit 92be45d1be

View File

@ -8,7 +8,7 @@ print "Usage: $0 [FILE]\n\tParses [FILE], outputing the result to [FILE].out.\n"
my ($input) = @ARGV;
my ($output) = $input . '.out';
my ($found, $start);
my ($found, $start, $first);
print "Copyleft© 2006, Russ Rowan (See `COPYING')\n" and exit if $input eq '-v';
open FILEIN, "<$input" or print "File `$input' was not found.\n" and exit;
open FILEOUT, ">$output" or print "Cannot open $output for writing.\n" and exit;
@ -17,10 +17,11 @@ while (<FILEIN>)
{
if ($found)
{
next if $_ =~ /^\s+\*\s$/;
if ($_ =~ /^\s+\*\s$/) { next if $first; $_ =~ s/\*// if not $first; }
if ($_ =~ /^\s\*+\/$/ or $_ !~ /^\s/) { $found = undef; next; }
$_ =~ s/^(\s*)\s\*\s/$1/;
$found = 'sorta' if $_ =~ s/\s*\*\/$//;
$first = undef;
}
elsif ($_ =~ /^\s*\/\*\*\s(.*)/)
{
@ -29,6 +30,7 @@ while (<FILEIN>)
if ($_ =~ s/\s*\*\/$//) { $found = 'sorta'; } else { $found = $.; }
my $dash; for (my $x = 0; $x < length($_); $x++) { $dash .= '-'; }
$_ = "$_\n$dash\n";
$first = 1;
}
elsif ($_ =~ /\s*([A-Z0-9_]+),\s*\/\*::\s*(.*)\s*\*\/$/)
{