summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2012-02-05 00:15:15 +0100
committerPaul Buetow <paul@buetow.org>2012-02-05 00:15:15 +0100
commit7c48c5216f13fe80dd5c0a44e96da95d8162e684 (patch)
tree001bd322a82be69f8c294abd9422b6ed2ce0988f
parentdf78a4694c9bb215f27c22f5f3b325462665e968 (diff)
Some read_config bugs fixed
-rwxr-xr-xloadbars12
1 files changed, 7 insertions, 5 deletions
diff --git a/loadbars b/loadbars
index c842ecd..228da73 100755
--- a/loadbars
+++ b/loadbars
@@ -146,18 +146,20 @@ sub read_config () {
while (<$conffile>) {
chomp;
- next if /^[\t\s]*#/;
- s/[\t\s]*#.*//;
+ s/[\t\s]*?#.*//;
next unless length;
- my ($key, $val) = split /=/, $_;
- trim $key; trim $val;
+ my ($key, $val) = split '=';
unless (defined $val) {
display_warn "Could not parse config line: $_";
+ next;
+ }
+
+ trim $key; trim $val;
- } elsif (not exists $C{$key}) {
+ if (not exists $C{$key}) {
display_warn "There is no such config key: $key, ignoring";
} else {