#!/usr/bin/perl

if(!@ARGV){@ARGV=("/dev/stdin")};
for $f (@ARGV){
	open(F,'<',$f) || die "open($f): $!";
	binmode(F);
	my $h;
	my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
	    $atime,$mtime,$ctime,$blksize,$blocks)
	    = stat($f);
	for(my $i=0;$i<$size-8;$i++){
		seek(F,$i,0);
		if(read(F,$h,8) != 8){last};
		my ($inode,$elen,$nlen,$type)=unpack("LSCC",$h);
		if($elen <= 9){next};
		my $e;
		read(F,$e,$elen-8);
		$name=substr($e,0,$nlen);
		#print "Inode: $inode, elen: $elen, nlen: $nlen, type:$type, name: <$name>\n";
		if(!$inode && ($type == 1)){print "$name\n"};
	}
	close(F);
}