From 4529f8a62f5fb91ffca547192a785371bab06b26 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 21 May 2006 23:13:01 +0000 Subject: [PATCH 1/1] put every variable in config into the hash, only output the interesting ones (like thomas old code did) --- snom.pl | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) 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"; + } } } -- 2.39.5