Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/postfix/postfix_mailstats_ | ||
|---|---|---|
| 169 | 169 |
if (-l $statefile) |
| 170 | 170 |
{
|
| 171 | 171 |
die ("$statefile is a symbolic link, refusing to touch it.");
|
| 172 |
}
|
|
| 172 |
} |
|
| 173 | 173 |
open (OUT, '>', $statefile) or die "Unable to open statefile: $!\n"; |
| 174 | 174 |
print OUT "$pos:$delivered\n"; |
| 175 | 175 |
foreach my $i (sort keys %{$rejects})
|
| ... | ... | |
| 178 | 178 |
} |
| 179 | 179 |
close OUT; |
| 180 | 180 |
|
| 181 |
sub parseLogfile
|
|
| 182 |
{
|
|
| 181 |
sub parseLogfile |
|
| 182 |
{
|
|
| 183 | 183 |
my ($fname, $start, $stop) = @_; |
| 184 | 184 |
open (LOGFILE, $fname) |
| 185 | 185 |
or die "Unable to open logfile $fname for reading: $!\n"; |
| 186 | 186 |
seek (LOGFILE, $start, 0) |
| 187 | 187 |
or die "Unable to seek to $start in $fname: $!\n"; |
| 188 | 188 |
|
| 189 |
while (tell (LOGFILE) < $stop)
|
|
| 189 |
while (tell (LOGFILE) < $stop) |
|
| 190 | 190 |
{
|
| 191 | 191 |
my $line = <LOGFILE>; |
| 192 | 192 |
chomp ($line); |
| 193 | 193 |
|
| 194 | 194 |
if ($line =~ /$postfix\/qmgr.*from=.*size=[0-9]*/ || |
| 195 |
$line =~ /$postfix\/smtp.* status=sent /)
|
|
| 195 |
$line =~ /$postfix\/smtp.* status=sent /) |
|
| 196 | 196 |
{
|
| 197 | 197 |
$delivered++; |
| 198 |
}
|
|
| 198 |
} |
|
| 199 | 199 |
elsif ($line =~ /$postfix\/smtpd.*reject: \S+ \S+ \S+ (\S+)/ || |
| 200 | 200 |
$line =~ /$postfix\/cleanup.* reject: (\S+)/) |
| 201 | 201 |
{
|
| 202 | 202 |
$rejects->{$1}++;
|
| 203 | 203 |
} |
| 204 | 204 |
} |
| 205 |
close(LOGFILE) or warn "Error closing $fname: $!\n";
|
|
| 205 |
close(LOGFILE) or warn "Error closing $fname: $!\n"; |
|
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
# vim:syntax=perl |
Formats disponibles : Unified diff