#!/usr/bin/perl
# show the last 3 totals lines from a list of hosts.

$| = 1;
$n = 3;
$failures = 0;

for	$h (@ARGV) {
	$h =~ s".*/"";
	$h = "hst/$h";
	if (open(H,$h)) {
		@T = ();
		for $l (<H>) {
			if ($l =~ /( T L:)|(No ABC)/) {
				push @T, "$l";
				shift @T if (int(@T) > 3);
			}
		}
		close H;
		print @T;

	} else {
		print STDERR "$0: Can't read \"$h\" ($!)\n";
		++$failures;
	}
}

exit $failures;
