From b0203771a3788760ac7f2041ed8a633de00cc0a9 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 23 Mar 2001 15:31:58 +0000 Subject: enable use of gzip'ed Cards+, CardsNames and MonitorsDB --- perl-install/Xconfigurator.pm | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 3959241b5..701ba190e 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -31,8 +31,7 @@ sub readCardsDB { my ($file) = @_; my ($card, %cards); - local *F; - open F, $file or die "file $file not found"; + my $F = common::openFileMaybeCompressed($file); my ($lineno, $cmd, $val) = 0; my $fs = { @@ -64,7 +63,7 @@ sub readCardsDB { }; local $_; - while () { $lineno++; + while (<$F>) { $lineno++; s/\s+$//; /^#/ and next; /^$/ and next; @@ -80,15 +79,12 @@ sub readCardsDB { } sub readCardsNames { my $file = "$ENV{SHARE_PATH}/ldetect-lst/CardsNames"; - local *F; open F, $file or die "can't find $file\n"; - map { (split '=>')[0] } grep { !/^#/ } ; + map { (split '=>')[0] } grep { !/^#/ } catMaybeCompressed($file); } sub cardName2RealName { - my $file = "$ENV{SHARE_PATH}/ldetect-lst/CardsNames"; my ($name) = @_; - local *F; open F, $file or die "can't find $file\n"; - local $_; - while () { + my $file = "$ENV{SHARE_PATH}/ldetect-lst/CardsNames"; + foreach (catMaybeCompressed($file)) { chop; next if /^#/; my ($name_, $real) = split '=>'; @@ -110,9 +106,9 @@ sub readMonitorsDB { %monitors and return; - local *F; open F, $file or die "can't open monitors database ($file): $!"; + my $F = common::openFileMaybeCompressed($file); local $_; - my $lineno = 0; while () { + my $lineno = 0; while (<$F>) { $lineno++; s/\s+$//; /^#/ and next; -- cgit v1.2.1