put every variable in config into the hash, only output the interesting ones
authormichael <michael>
Sun, 21 May 2006 23:13:01 +0000 (23:13 +0000)
committermichael <michael>
Sun, 21 May 2006 23:13:01 +0000 (23:13 +0000)
(like thomas old code did)

snom.pl

diff --git a/snom.pl b/snom.pl
index 909526b..a9c6e0f 100755 (executable)
--- a/snom.pl
+++ b/snom.pl
@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/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
 
 
 # http://developer.gnome.org/doc/API/2.2/gtk/gtk-migrating-GtkComboBox.html
 
@@ -33,10 +33,8 @@ while(<INIFILE>) {
        }
 
        if (@sections) {
        }
 
        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 $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";
+               }
 
        }
 }
 
        }
 }
Impressum, Datenschutz