From fd2e97c488f7ba4603150215b33393d986771561 Mon Sep 17 00:00:00 2001 From: Tobias Becker Date: Sat, 23 Oct 2004 17:40:21 +0000 Subject: [PATCH] Fix for t:? in ratefile after T: lines with day * and other days. --- isdnlog/tools/dest/pp_rate | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/isdnlog/tools/dest/pp_rate b/isdnlog/tools/dest/pp_rate index c8c5d017..04549f8d 100755 --- a/isdnlog/tools/dest/pp_rate +++ b/isdnlog/tools/dest/pp_rate @@ -511,8 +511,26 @@ sub fill_T (\@$$$$) { # step 1 - get already definied day/hour sets. my ($dh, $Tline, $numday, $only_anyday); + # step 1.1 - scan for used day types $numday = 0; $only_anyday = 1; # only T: for day "*" present + foreach $Tline (@$Ttags) { + my $day; + if ($Tline =~ /^T:\s*(\[[^\]]+\])\s*([1-7WEH,*-]+)\s*\/\s*([0-9,*-]+)\s*=/ ) { + next if ($range and $1 ne $range); # only T: for same date range + $day = $2; + } + elsif ($Tline =~ /^T:\s*([1-7WEH,*-]+)\s*\/\s*([0-9,*-]+)\s*=/ ) { + $day = $1; + } + else { + next; + } + $only_anyday = 0 if ($day !~ /^\*$/); + $holiday = 1 if ($day =~ /H/); + $numday = 1 if ($day =~ /\d/); # use numbers (1-7) instead of WEH + } + # step 1.2 - store already defined day/hour sets. foreach $Tline (@$Ttags) { my ($day, $aday, @days, $hour, $ahour, @hours); if ($Tline =~ /^T:\s*(\[[^\]]+\])\s*([1-7WEH,*-]+)\s*\/\s*([0-9,*-]+)\s*=/ ) { @@ -528,8 +546,6 @@ sub fill_T (\@$$$$) { print "Unrecognized T: format: $Tline"; next; } - $numday = 1 if ($day =~ /\d/); # use numbers (1-7) instead of W|E|H - $only_anyday = 0 if ($day ne "*"); foreach $aday (split(/,/, $day)) { if ($aday =~ /^(\d)-(\d)$/) { push @days, ($1 .. $2); @@ -538,7 +554,7 @@ sub fill_T (\@$$$$) { push @days, ($1); if ($1 eq "*") { push @days, (1..7); - push @days, ("H"); + push @days, ("H") if ($holiday); } elsif ($1 eq "W") { push @days, (1..5);