diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-12-01 08:53:47 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-12-01 08:53:47 +0000 |
commit | 27968886bf2586682cb1a6f45eb8b485dc6a4257 (patch) | |
tree | 8ee761eb8c2fe9067af23fa2d38348284d84ea9f /perl-install/modparm.pm | |
parent | 11c086f6eb07e76fec02c5627072d52b4d6cd7d8 (diff) | |
download | drakx-27968886bf2586682cb1a6f45eb8b485dc6a4257.tar drakx-27968886bf2586682cb1a6f45eb8b485dc6a4257.tar.gz drakx-27968886bf2586682cb1a6f45eb8b485dc6a4257.tar.bz2 drakx-27968886bf2586682cb1a6f45eb8b485dc6a4257.tar.xz drakx-27968886bf2586682cb1a6f45eb8b485dc6a4257.zip |
no_comment
Diffstat (limited to 'perl-install/modparm.pm')
-rw-r--r-- | perl-install/modparm.pm | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/perl-install/modparm.pm b/perl-install/modparm.pm index 652f4aa24..067c2477e 100644 --- a/perl-install/modparm.pm +++ b/perl-install/modparm.pm @@ -10,18 +10,15 @@ use common qw(:common :functional); use log; -#-##################################################################################### -#- Globals -#-##################################################################################### -my %modparm_hash; #-###################################################################################### #- Functions #-###################################################################################### -sub read_modparm_file($) { - my ($file) = @_; +sub read_modparm_file { + my $file = -e "modparm.lst" ? "modparm.lst" : "/usr/share/modparm.lst"; my @line; + my %modparm_hash; local *F; open F, $file or log::l("missing $file: $!"), return; foreach (<F>) { @@ -34,24 +31,25 @@ sub read_modparm_file($) { desc => $line [4], }; } + \%modparm_hash; } sub get_options_result($@) { my ($module, @value) = @_; + my $modparm_hash = modparm::read_modparm_file; mapn { my ($a, $b) = @_; $a ? "$b=$a" : () - } \@value, [ keys %{$modparm_hash{$module}} ]; + } \@value, [ keys %{$modparm_hash->{$module}} ]; } sub get_options_name($) { my ($module) = @_; my @names; + my $modparm_hash = modparm::read_modparm_file; - %modparm_hash or return; - - while (my ($k, $v) = each %{$modparm_hash{$module} || {}}) { + while (my ($k, $v) = each %{$modparm_hash->{$module} || {}}) { my $opttype = $v->{type}; my $default = $v->{default}; push @names, "$k ($v->{type})" . (defined($v->{default}) && "[$v->{default}]"); |