forked from extern/shorewall_code
Don't copy headers in imported libraries
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
e9dffbace2
commit
fe089ddc36
@ -93,21 +93,12 @@ sub generate_script_1() {
|
|||||||
copy $globals{SHAREDIRPL} . 'prog.header6';
|
copy $globals{SHAREDIRPL} . 'prog.header6';
|
||||||
}
|
}
|
||||||
|
|
||||||
copy $globals{SHAREDIR} . '/lib.common';
|
copy2 $globals{SHAREDIR} . '/lib.common';
|
||||||
}
|
}
|
||||||
|
|
||||||
my $lib = find_file 'lib.private';
|
my $lib = find_file 'lib.private';
|
||||||
|
|
||||||
if ( -f $lib ) {
|
copy2 $lib if -f $lib;
|
||||||
emit <<'EOF';
|
|
||||||
################################################################################
|
|
||||||
# Functions imported from lib.private
|
|
||||||
################################################################################
|
|
||||||
EOF
|
|
||||||
|
|
||||||
copy1 $lib;
|
|
||||||
emit "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
emit <<'EOF';
|
emit <<'EOF';
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -81,6 +81,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
|||||||
pop_indent
|
pop_indent
|
||||||
copy
|
copy
|
||||||
copy1
|
copy1
|
||||||
|
copy2
|
||||||
create_temp_aux_config
|
create_temp_aux_config
|
||||||
finalize_aux_config
|
finalize_aux_config
|
||||||
set_shorewall_dir
|
set_shorewall_dir
|
||||||
@ -1199,6 +1200,62 @@ sub copy1( $ ) {
|
|||||||
$result;
|
$result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# This one drops header comments and replaces them with a three-line banner
|
||||||
|
#
|
||||||
|
sub copy2( $ ) {
|
||||||
|
assert( $script_enabled );
|
||||||
|
|
||||||
|
if ( $script ) {
|
||||||
|
my $file = $_[0];
|
||||||
|
my $first = 1;
|
||||||
|
|
||||||
|
open IF , $file or fatal_error "Unable to open $file: $!";
|
||||||
|
|
||||||
|
while ( <IF> ) {
|
||||||
|
last unless /^#/;
|
||||||
|
$first = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
print $script <<EOF;
|
||||||
|
################################################################################
|
||||||
|
# Functions imported from $file
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
EOF
|
||||||
|
print $script $_ if $first;
|
||||||
|
|
||||||
|
while ( <IF> ) {
|
||||||
|
chomp;
|
||||||
|
if ( /^\s*$/ ) {
|
||||||
|
print $script "\n" unless $lastlineblank;
|
||||||
|
$lastlineblank = 1;
|
||||||
|
} else {
|
||||||
|
if ( $indent ) {
|
||||||
|
s/^(\s*)/$indent1$1$indent2/;
|
||||||
|
s/ /\t/ if $indent2;
|
||||||
|
}
|
||||||
|
|
||||||
|
print $script $_;
|
||||||
|
print $script "\n";
|
||||||
|
$lastlineblank = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close IF;
|
||||||
|
|
||||||
|
print $script "\n" unless $lastlineblank;
|
||||||
|
|
||||||
|
print $script <<EOF;
|
||||||
|
################################################################################
|
||||||
|
# End of imports from $file
|
||||||
|
################################################################################
|
||||||
|
EOF
|
||||||
|
$lastlineblank = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create the temporary script file -- the passed file name is the name of the final file.
|
# Create the temporary script file -- the passed file name is the name of the final file.
|
||||||
# We create a temporary file in the same directory so that we can use rename to finalize it.
|
# We create a temporary file in the same directory so that we can use rename to finalize it.
|
||||||
|
@ -527,7 +527,3 @@ truncate() # $1 = length
|
|||||||
{
|
{
|
||||||
cut -b -${1}
|
cut -b -${1}
|
||||||
}
|
}
|
||||||
|
|
||||||
#################################################################################
|
|
||||||
# End of lib.common
|
|
||||||
#################################################################################
|
|
||||||
|
@ -462,7 +462,3 @@ truncate() # $1 = length
|
|||||||
{
|
{
|
||||||
cut -b -${1}
|
cut -b -${1}
|
||||||
}
|
}
|
||||||
|
|
||||||
#################################################################################
|
|
||||||
# End of lib.common
|
|
||||||
#################################################################################
|
|
||||||
|
Loading…
Reference in New Issue
Block a user