summaryrefslogtreecommitdiffstats
path: root/perl-install/modparm.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>1999-09-07 13:38:46 +0000
committerFrancois Pons <fpons@mandriva.com>1999-09-07 13:38:46 +0000
commit5d31c65a29a5be64fe46946651108e0e13242037 (patch)
tree31a9081dedce7b89bb8260ffb6f0256ec9ec60b6 /perl-install/modparm.pm
parent13cafe674927c9f8b8feaadd0c4b6bc9e5104fb7 (diff)
downloaddrakx-backup-do-not-use-5d31c65a29a5be64fe46946651108e0e13242037.tar
drakx-backup-do-not-use-5d31c65a29a5be64fe46946651108e0e13242037.tar.gz
drakx-backup-do-not-use-5d31c65a29a5be64fe46946651108e0e13242037.tar.bz2
drakx-backup-do-not-use-5d31c65a29a5be64fe46946651108e0e13242037.tar.xz
drakx-backup-do-not-use-5d31c65a29a5be64fe46946651108e0e13242037.zip
*** empty log message ***
Diffstat (limited to 'perl-install/modparm.pm')
-rw-r--r--perl-install/modparm.pm80
1 files changed, 80 insertions, 0 deletions
diff --git a/perl-install/modparm.pm b/perl-install/modparm.pm
new file mode 100644
index 000000000..a630cdd5c
--- /dev/null
+++ b/perl-install/modparm.pm
@@ -0,0 +1,80 @@
+package modparm;
+
+use log;
+
+my %modparm_hash;
+
+sub read_modparm_file($) {
+ my ($file) = @_;
+ my @line;
+
+ open F, $file;
+ while (<F>) {
+ chomp;
+ @line = split ':';
+
+ $modparm_hash{$line[0]}{$line[1]} = {
+ type => $line[2],
+ default => $line[3],
+ desc => $line [4],
+ };
+ }
+ close F;
+}
+
+sub get_options_result($;$) {
+ my ($module,$value) = @_;
+ my @names = keys %{$modparm_hash{$module}};
+ my $options;
+ my $result;
+ my $i;
+
+ for $i (0..$#$value) {
+ $result = $ {$value->[$i]};
+
+ if ($result != "") {
+ $options .= "$names[$i]=$result ";
+ }
+ }
+
+ return $options;
+}
+
+sub get_options_name($) {
+ my ($module) = @_;
+ my @names = keys %{$modparm_hash{$module}};
+ my @result;
+ my $opttype;
+ my $default;
+
+ foreach (@names) {
+ $opttype = $modparm_hash{$module}{$_}{type};
+ $default = $modparm_hash{$module}{$_}{default};
+
+ if (defined($default)) {
+ push @result, _("$_ ($opttype)[$default]");
+ } else {
+ push @result, _("$_ ($opttype)");
+ }
+ }
+
+ return \@result;
+}
+
+sub get_options_value($) {
+ my ($module) = @_;
+ my @names = keys %{$modparm_hash{$module}};
+ my @result;
+
+ for $i (0..$#names) {
+ my $value = "";
+
+ $result[$i] = \$value;
+ }
+
+ return \@result;
+}
+
+read_modparm_file("/tmp/modparm.txt");
+
+1;