Surrender to the reality of Perl multi-line strings

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5490 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-03-11 03:38:43 +00:00
parent 8685b26aa8
commit 0274f95e7d

View File

@ -428,19 +428,10 @@ sub default_yes_no ( $$ ) {
#
# Write the argument to the object file with the current indentation.
#
# Since emacs doesn't understand Perl's rendition of 'here documents', we
# use multi-line quoting instead. To make multi-line emit calls look better,
# we delete a leading newline and add one to the end.
#
sub emit ( $ ) {
my $line = $_[0];
$line =~ s/^\n//;
if ( $indent || $line ) {
$line =~ s/^/$indent/;
$line =~ s/\n(.)/\n$indent$1/g;
}
$line =~ s/^/$indent/ if $indent && $line;
print $object "$line\n";
}
@ -5418,6 +5409,9 @@ sub do_initialize() {
initialize_chain_table;
}
sub compile_stop_firewall() {
}
sub compile_firewall( $ ) {
my $objectfile = $_[0];
@ -5444,13 +5438,30 @@ sub compile_firewall( $ ) {
my $date = localtime;
emit "
#
# Compiled firewall script generated by Shorewall $env{VERSION} - $date
#";
emit "#\n# Compiled firewall script generated by Shorewall $env{VERSION} - $date\n#";
if ( $ENV{EXPORT} ) {
emit 'SHAREDIR=/usr/share/shorewall-lite';
emit 'CONFDIR=/etc/shorewall-lite';
emit 'VARDIR=/var/lib/shorewall-lite';
indent "$env{SHAREDIR}/lib.base";
emit '################################################################################';
emit '# End of /usr/share/shorewall/lib.base';
emit '################################################################################';
} else {
emit 'SHAREDIR=/usr/share/shorewall';
emit 'CONFDIR=/etc/shorewall';
emit "VARDIR=/var/lib/shorewall\n";
emit '. /usr/share/shoreall-lite/lib.base';
}
}
#
# Compile the program to stop the firewall
#
compile_stop_firewall;
}
#
# Process the zones file.
#