Improve emitj()

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5717 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-03-27 16:51:33 +00:00
parent b522fb46a2
commit 03a4c6c322

View File

@ -174,7 +174,7 @@ sub emit ( $ ) {
print $object "$line\n";
$lastlineblank = ( substr( $line, -1, 1 ) eq "\n" );
} else {
print $object "\n" unless $lastlineblank;
print $object "\n" unless $lastlineblank;
$lastlineblank = 1;
}
}
@ -185,7 +185,22 @@ sub emit ( $ ) {
#
sub emitj {
if ( $object ) {
for ( @_ ) { emit $_ };
#
# 'compile' as opposed to 'check'
#
for ( @_ ) {
unless ( /^\s*$/ ) {
my $line = $_;
$line =~ s/^\n// if $lastlineblank;
$line =~ s/^/$indent/gm if $indent;
1 while $line =~ s/^ /\t/;
print $object "$line\n";
$lastlineblank = ( substr( $line, -1, 1 ) eq "\n" );
} else {
print $object "\n" unless $lastlineblank;
$lastlineblank = 1;
}
}
}
}