From: michael Date: Sun, 21 May 2006 23:13:01 +0000 (+0000) Subject: put every variable in config into the hash, only output the interesting ones X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/snom-frontend/commitdiff_plain/4529f8a62f5fb91ffca547192a785371bab06b26?hp=2ccc8dda48e6c58e39c2be812ca71e70c1e04b4e put every variable in config into the hash, only output the interesting ones (like thomas old code did) --- diff --git a/snom.pl b/snom.pl index 909526b..a9c6e0f 100755 --- a/snom.pl +++ b/snom.pl @@ -1,5 +1,5 @@ #!/bin/sh -#$Id: snom.pl,v 1.23 2006-05-21 23:08:48 sithglan Exp $ +#$Id: snom.pl,v 1.24 2006-05-21 23:13:01 michael Exp $ # http://developer.gnome.org/doc/API/2.2/gtk/gtk-migrating-GtkComboBox.html @@ -33,10 +33,8 @@ while() { } if (@sections) { - for my $var (qw(host login password)) { - if (m/^\s*${var}\s*=\s*(.*)\s*$/) { - ${$Config{$sections[$#sections]}}{$var} = $1; - } + if (m/^\s*(.+)\s*=\s*(.*)\s*$/) { + ${$Config{$sections[$#sections]}}{$1} = $2; } } } @@ -44,13 +42,10 @@ close(INIFILE); for my $section (@sections) { - for my $val (keys(%{$Config{$section}})) { - print "$section: $val: <" . ${$Config{$section}}{$val}.">\n"; - #for my $val (qw(host login password)) { - # if (defined($cfg->val($section, $val))) { - # print "$val: <" . $cfg->val($section, $val) . ">\n"; - # } - #} + for my $val (qw(host login password)) { + if (defined(${$Config{$section}}{$val})) { + print "$section: $val: <" . ${$Config{$section}}{$val}.">\n"; + } } }