Skip to content

Commit

Permalink
End of line whitespace regex fix
Browse files Browse the repository at this point in the history
  • Loading branch information
leon.j.ward committed Dec 1, 2010
1 parent 95d3b7d commit 234941d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dumbpig.pl
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,17 @@ sub usage{
my $originalline = $line;
$linenum++;

if ($fixnormbug ) {
if ($fixnormbug) {
# There is a minor bug in the Parse::Snort module with whitespace, while waiting for a fix (reported) lets "fix" it here.

# Thanks to Tom Dixon for spotting the problem.
# Thanks to Per Kristian Johnsen for pointing out that I was breaking peoples rules by writing this output to file.

#$line =~ s/ *$//g; # Remove end of line whitespace
$line =~ s/: *"/:"/g; # Remove extra space after : eg. msg: "foo";
$line =~ s/^\s+(alert|drop|pass|reject|activate|dynamic|activate)/$1/g; # Remove ws before action keyword e.g. ^ alert ip any
$line =~ s/\s+/ /g; # Normalize All whitespace <- This is brutal and breakes the formatted output

if ($line =~ m/\)\s/) {
$line =~ s/\)\s/\)/;
}
}

if ($comment) {
Expand Down

0 comments on commit 234941d

Please sign in to comment.