Improve emitj() -- take 2

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5718 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-03-27 17:07:43 +00:00
parent 03a4c6c322
commit c5be50d484

View File

@ -170,7 +170,7 @@ sub emit ( $ ) {
unless ( $line =~ /^\s*$/ ) { unless ( $line =~ /^\s*$/ ) {
$line =~ s/^\n// if $lastlineblank; $line =~ s/^\n// if $lastlineblank;
$line =~ s/^/$indent/gm if $indent; $line =~ s/^/$indent/gm if $indent;
1 while $line =~ s/^ /\t/m; $line =~ s/ /\t/gm;
print $object "$line\n"; print $object "$line\n";
$lastlineblank = ( substr( $line, -1, 1 ) eq "\n" ); $lastlineblank = ( substr( $line, -1, 1 ) eq "\n" );
} else { } else {
@ -181,7 +181,7 @@ sub emit ( $ ) {
} }
# #
# Jacket for emit() that accepts an indefinite number of arguments; each argument will be emitted as a separate line # Version of emit() that accepts an indefinite number of arguments; each argument will be emitted as a separate line
# #
sub emitj { sub emitj {
if ( $object ) { if ( $object ) {
@ -193,7 +193,7 @@ sub emitj {
my $line = $_; my $line = $_;
$line =~ s/^\n// if $lastlineblank; $line =~ s/^\n// if $lastlineblank;
$line =~ s/^/$indent/gm if $indent; $line =~ s/^/$indent/gm if $indent;
1 while $line =~ s/^ /\t/; $line =~ s/ /\t/g;
print $object "$line\n"; print $object "$line\n";
$lastlineblank = ( substr( $line, -1, 1 ) eq "\n" ); $lastlineblank = ( substr( $line, -1, 1 ) eq "\n" );
} else { } else {