From 0aa190e15fe734788fb43fa6de5f84b9dbdc1f69 Mon Sep 17 00:00:00 2001 From: teastep Date: Fri, 30 Mar 2007 03:30:28 +0000 Subject: [PATCH] Move some code around git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5755 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- New/Shorewall/Config.pm | 86 ++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/New/Shorewall/Config.pm b/New/Shorewall/Config.pm index 1e713eb58..f323ac75d 100644 --- a/New/Shorewall/Config.pm +++ b/New/Shorewall/Config.pm @@ -293,49 +293,6 @@ sub split_line( $$ ) { @line; } -sub default ( $$ ) { - my ( $var, $val ) = @_; - - $config{$var} = $val unless defined $config{$var} && $config{$var} ne ''; -} - -sub default_yes_no ( $$ ) { - my ( $var, $val ) = @_; - - my $curval = "\L$config{$var}"; - - if ( $curval ) { - if ( $curval eq 'no' ) { - $config{$var} = ''; - } else { - fatal_error "Invalid value for $var ($val)" unless $curval eq 'yes'; - } - } else { - $config{$var} = $val; - } -} - -sub report_capabilities() { - sub report_capability( $ ) { - my $cap = $_[0]; - print " $capdesc{$cap}: "; - print $capabilities{$cap} ? "Available\n" : "Not Available\n"; - } - - print "Shorewall has detected the following capabilities:\n"; - - for my $cap ( sort { $capdesc{$a} cmp $capdesc{$b} } keys %capabilities ) { - report_capability $cap; - } -} - -sub require_capability( $$ ) { - my ( $capability, $description ) = @_; - - fatal_error "$description requires $capdesc{$capability} in your kernel and iptables" - unless $capabilities{$capability}; -} - # # Some files can have shell variables embedded. This function expands them from %ENV. # @@ -456,6 +413,49 @@ sub read_a_line { } } +sub default ( $$ ) { + my ( $var, $val ) = @_; + + $config{$var} = $val unless defined $config{$var} && $config{$var} ne ''; +} + +sub default_yes_no ( $$ ) { + my ( $var, $val ) = @_; + + my $curval = "\L$config{$var}"; + + if ( $curval ) { + if ( $curval eq 'no' ) { + $config{$var} = ''; + } else { + fatal_error "Invalid value for $var ($val)" unless $curval eq 'yes'; + } + } else { + $config{$var} = $val; + } +} + +sub report_capabilities() { + sub report_capability( $ ) { + my $cap = $_[0]; + print " $capdesc{$cap}: "; + print $capabilities{$cap} ? "Available\n" : "Not Available\n"; + } + + print "Shorewall has detected the following capabilities:\n"; + + for my $cap ( sort { $capdesc{$a} cmp $capdesc{$b} } keys %capabilities ) { + report_capability $cap; + } +} + +sub require_capability( $$ ) { + my ( $capability, $description ) = @_; + + fatal_error "$description requires $capdesc{$capability} in your kernel and iptables" + unless $capabilities{$capability}; +} + # # - Read the shorewall.conf file # - Read the capabilities file created by the compiler front-end