Support 'yes', 'no, <other> values for simple config options

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2014-09-27 07:57:46 -07:00
parent bc8588a68e
commit a09484356c

View File

@ -3503,8 +3503,8 @@ sub default ( $$ ) {
#
# Provide a default value for a yes/no configuration variable.
#
sub default_yes_no ( $$ ) {
my ( $var, $val ) = @_;
sub default_yes_no ( $$;$ ) {
my ( $var, $val, $other ) = @_;
my $curval = $config{$var};
@ -3513,8 +3513,17 @@ sub default_yes_no ( $$ ) {
if ( $curval eq 'no' ) {
$config{$var} = '';
} elsif ( defined( $other ) && $curval eq $other ) {
#
# Downshift value for later comparison
#
$config{$var} = $curval;
} else {
fatal_error "Invalid value for $var ($curval)" unless $curval eq 'yes';
#
# Make Case same as default
#
$config{$var} = 'Yes';
}
} else {
$config{$var} = $val;