From: Thomas Hochstein Date: Sun, 31 Oct 2010 21:00:16 +0000 (+0100) Subject: groupstats.pl: Improve automatic adaption of output type. X-Git-Tag: 0.01~16 X-Git-Url: https://code.th-h.de/?p=usenet%2Fnewsstats.git;a=commitdiff_plain;h=e742bcf55044f7cf2bbb8e47fdca820e35ad36ba groupstats.pl: Improve automatic adaption of output type. If time period is more than on month, switch from dump to dumpgroup, if possible (just one newsgroup submitted via -n), and switch to pretty only if that fails. Signed-off-by: Thomas Hochstein --- diff --git a/groupstats.pl b/groupstats.pl index f758b8c..ef59cb7 100755 --- a/groupstats.pl +++ b/groupstats.pl @@ -73,10 +73,15 @@ if ($Options{'l'}) { ### get time period my ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'}); -# reset to one month for 'dump' output type +# if time period is more than one month: set output type to '-o pretty' or '-o dumpgroup' if ($Options{'o'} eq 'dump' and $Options{'p'}) { - warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o pretty'.\n"); - $Options{'o'} = 'pretty'; + if (defined($Options{'n'}) and $Options{'n'} !~ /:|\*/) { + warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o dumpgroup'.\n"); + $Options{'o'} = 'dumpgroup'; + } else { + warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o pretty'.\n"); + $Options{'o'} = 'pretty'; + } }; ### init database