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

$/ = '<<<';
$log = "ztrans";
$ct=0;
while($#zephyrs <= $ARGV[1]){
    open(ZT, "/usr/tmp/$log");
    while(<ZT>){
	$_=~/([^>]+)>>>:(.*)/;
	$name = $1;
	$when = $2;
	$body = $';
	$body =~ s/<<<//;
	$body =~ s/\/\*.+\*\///;
	$body =~ s/\n\n/\n/;
	if($name=~/$ARGV[0]/i){
	    $msgn++;
	    $nzephyrs[$#nzephyrs+1] = "---------------\n".$name." $when ($msgn from $log)\n---------------";
	    $nzephyrs[$#nzephyrs] .= $body;
	}
    }
    close(ZT);
    @zephyrs = (@nzephyrs, @zephyrs);
    @nzephyrs = ();
    $oldlog = $log;
    $log = "ztrans.$ct";
    $ct++;
    if(!-e "/usr/tmp/$log"){
	last;
    }
}
	$ARGV[1] = $#zephyrs unless $ARGV[1];

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