#!/afs/athena/contrib/perl/p

$/ = '<<<';
open(ZT, "tail -f /usr/tmp/ztrans|");
while(<ZT>){
    $_=~/([^>]+)>>>:(.*)/;
    $name = $1;
    $when = $2;
    $body = $';
    $body =~ s/<<<//;
    if($name=~/$ARGV[0]/i){
	$zephyrs[$#zephyrs+1] = "---------------\n".$name." $when\n---------------";
	$zephyrs[$#zephyrs] .= $body;
    }
}
close(ZT);

$ARGV[1] = $#zephyrs unless $ARGV[1];

print($#zephyrs+1, " zephyrs matching\n");
$zs = $#zephyrs-$ARGV[1]+1;
for $n ($zs..$#zephyrs){
    print("$zephyrs[$n]");
}
