mirror of
https://gitlab.com/shorewall/code.git
synced 2025-02-23 21:21:49 +01:00
Allow indefinite alternative to 'yes' and 'no'
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
a09484356c
commit
38a18ac9ac
@ -3505,6 +3505,7 @@ sub default ( $$ ) {
|
|||||||
#
|
#
|
||||||
sub default_yes_no ( $$;$ ) {
|
sub default_yes_no ( $$;$ ) {
|
||||||
my ( $var, $val, $other ) = @_;
|
my ( $var, $val, $other ) = @_;
|
||||||
|
my $result = 1;
|
||||||
|
|
||||||
my $curval = $config{$var};
|
my $curval = $config{$var};
|
||||||
|
|
||||||
@ -3513,11 +3514,19 @@ sub default_yes_no ( $$;$ ) {
|
|||||||
|
|
||||||
if ( $curval eq 'no' ) {
|
if ( $curval eq 'no' ) {
|
||||||
$config{$var} = '';
|
$config{$var} = '';
|
||||||
} elsif ( defined( $other ) && $curval eq $other ) {
|
} elsif ( defined( $other ) ) {
|
||||||
|
if ( $other eq '*' ) {
|
||||||
|
if ( $curval eq 'yes' ) {
|
||||||
|
$config{$var} = 'Yes';
|
||||||
|
} else {
|
||||||
|
$result = 0;
|
||||||
|
}
|
||||||
|
} elsif ( $curval eq $other ) {
|
||||||
#
|
#
|
||||||
# Downshift value for later comparison
|
# Downshift value for later comparison
|
||||||
#
|
#
|
||||||
$config{$var} = $curval;
|
$config{$var} = $curval;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fatal_error "Invalid value for $var ($curval)" unless $curval eq 'yes';
|
fatal_error "Invalid value for $var ($curval)" unless $curval eq 'yes';
|
||||||
#
|
#
|
||||||
@ -3528,6 +3537,8 @@ sub default_yes_no ( $$;$ ) {
|
|||||||
} else {
|
} else {
|
||||||
$config{$var} = $val;
|
$config{$var} = $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub default_yes_no_ipv4 ( $$ ) {
|
sub default_yes_no_ipv4 ( $$ ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user