Merge branch 'tools' into pu
[usenet/newsstats.git] / groupstats.pl
index 19c54e1..bed36e2 100755 (executable)
@@ -3,7 +3,7 @@
 # groupstats.pl
 #
 # This script will get statistical data on newgroup usage
 # groupstats.pl
 #
 # This script will get statistical data on newgroup usage
-# form a database.
+# from a database.
 # 
 # It is part of the NewsStats package.
 #
 # 
 # It is part of the NewsStats package.
 #
@@ -99,6 +99,8 @@ if ($Options{'a'}) {
 } else {
   ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'});
 };
 } else {
   ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'});
 };
+# if -p or -a are set: drop -m
+undef $Options{'m'} if ($Options{'p'} or $Options{'a'});
 # if time period is more than one month: force output type to '-o pretty' or '-o dumpgroup'
 if ($Options{'o'} eq 'dump' and ($Options{'p'} or $Options{'a'})) {
   if (defined($Options{'n'}) and $Options{'n'} !~ /:|\*/) {
 # if time period is more than one month: force output type to '-o pretty' or '-o dumpgroup'
 if ($Options{'o'} eq 'dump' and ($Options{'p'} or $Options{'a'})) {
   if (defined($Options{'n'}) and $Options{'n'} !~ /:|\*/) {
@@ -149,7 +151,7 @@ my $WhereClause = sprintf('month BETWEEN ? AND ? AND %s AND %s %s',$QueryGroupLi
 
 # get length of longest newsgroup delivered by query for formatting purposes
 # FIXME
 
 # get length of longest newsgroup delivered by query for formatting purposes
 # FIXME
-my $MaxLength = &GetMaxLenght($DBHandle,$Conf{'DBTableGrps'},'newsgroup',$WhereClause,$StartMonth,$EndMonth,(@GroupList,@Params));
+my $MaxLength = &GetMaxLength($DBHandle,$Conf{'DBTableGrps'},'newsgroup',$WhereClause,$StartMonth,$EndMonth,(@GroupList,@Params));
 
 my ($OrderClause,$DBQuery);
 # -b (best of / top list) defined?
 
 my ($OrderClause,$DBQuery);
 # -b (best of / top list) defined?
@@ -207,10 +209,10 @@ $DBQuery->execute($StartMonth,$EndMonth,@GroupList,@Params)
 undef($Options{'c'}) if $Options{'f'};
 # print caption (-c) with time period if -m or -p is set
 if ($Options{'c'}) {
 undef($Options{'c'}) if $Options{'f'};
 # print caption (-c) with time period if -m or -p is set
 if ($Options{'c'}) {
-  if ($Options{'p'}) {
-    printf ("----- Report from %s to %s\n",$StartMonth,$EndMonth);
-  } elsif ($Options{'m'}) {
+  if ($Options{'m'}) {
     printf ("----- Report for %s\n",$StartMonth);
     printf ("----- Report for %s\n",$StartMonth);
+  } else {
+    printf ("----- Report from %s to %s %s\n",$StartMonth,$EndMonth,$Options{'a'} ? '(all months)' : '');
   };
 };
 # print caption (-c) with newsgroup list if -n is set
   };
 };
 # print caption (-c) with newsgroup list if -n is set
This page took 0.011184 seconds and 4 git commands to generate.