#!/usr/local/bin/perl -w-- -*- perl -*-
#
# $Id:$
# $Source:$
# $Author:$
#

{
    local(@whoami) = split('/', $0);
    $whoami = pop(@whoami);
};

&usage if (scalar(@ARGV) != 2);
($input, $file) = (@ARGV);
$compress_magic = "\037\235\220#";
$/ = $compress_magic;
open(INPUT, "<$input") || die "can't open $input\n";

$found = 0;
while (<INPUT>)
{
    s/\000[^\000]([^\000]*)$compress_magic$//;
    $name = $1;
    if ($found)
    {
	$found = 0;
	open(UNCOMPRESS, "|uncompress -") || die "can't open uncompress\n";
	print UNCOMPRESS $compress_magic;
	print UNCOMPRESS $_;
	close(UNCOMPRESS);
	exit 0;
    }
    print $name, "\n";
    $found = ($name eq $file);
    $_ = "";
}
