File:  [Local Repository] / processmail / reminder.pl
Revision 3.2: download - view: text, annotated - select for diffs - revision graph
Fri Oct 11 15:39:35 2013 UTC (10 years, 7 months ago) by boris
Branches: MAIN
CVS tags: HEAD
Lev's changes

#!/usr/bin/perl
#
#$Id: reminder.pl,v 3.2 2013/10/11 15:39:35 boris Exp $
#
# Читаем файл и шлем e-mail
#
#
# Исходные файлы и параметры
#

    use Getopt::Std; 

$usage = 'reminder.pl $Revision: 3.2 $, $Date: 2013/10/11 15:39:35 $'. "\n".
"Usage: reminder.pl [-d] [-r round]  [-o results] \n";

require 'parameters.pl';
require 'subroutines.pl';

die $usage unless getopts('r:o:d');

$DEBUG=$opt_d;

my %teams;

#
# Читаем ответы команд
#
$round=0;
if ($opt_r)
{
    $round=$opt_r;
    foreach my $file ( @{$FILES[$opt_r]} ) {
	open (INFILE, $file);
	readmail(\%teams);
	close (INFILE);
    }
}
else
{
    *INFILE=*STDIN;
}
readmail(\%teams);
close(INFILE);

#
# Пишем мейл
#
if ($opt_o)
{ 
    die "Cannot open $opt_o\n" unless open(OUTFILE,">$opt_o");
}
else
{
    open(OUTFILE,"|/usr/lib/sendmail -oi -t");
}
select OUTFILE;
&printheader;
my $numletters=0;
foreach $team (keys %teams)
{
    my $num=$teams{$team}->{'numletters'};
    print  "$team [$num]\n";
    $numletters += $num;
}

print "\n------------------\n";
printf("Всего команд: %3d\n", scalar keys %teams);
printf("Всего писем:  %3d\n", $numletters);

&printfooter;

#
# На всякий случай проверяем на наличие команд с дублирующимися номерами.
#
check_dup_numbers(\%teams);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>