From 7c48c5216f13fe80dd5c0a44e96da95d8162e684 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 5 Feb 2012 00:15:15 +0100 Subject: Some read_config bugs fixed --- loadbars | 12 +++++++----- 1 file 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 { -- cgit v1.2.3