#!/bin/perl5 -w

$\ = "\n";

$AUTHORS="author-addrs";	# Clunky and hard-wired, but oh well

# Ripped out of split-logs.pl

# read the file of author addresses, and create the assoc. array.
printf "Reading $AUTHORS...";	# printf to avoid $\
open AUTHORS or die("Couldn't open authors file $AUTHORS, aborting.\n");
$author_name = "";
@author_names = ();
while (<AUTHORS>) {
    chomp;
    if (/^\t/) {
	s/^\s*//;
#	$author_addresses{lc($_)} = $author_name;
    }
    else {
	$author_name = $_;
	push @author_names, ($author_name);
    }
}
close AUTHORS;
print "done.";

while (<>) {
    chomp;
    if (/^[ \d].*/)
    {
	$name = substr($_,57,25);
	push @names, ($name);
    }
}

$oldname = "";

sub antigrep {
    $name = shift;
    @list = @_;
    for $expr (@list) {
	if ($name =~ /$expr/) { return 1 }
    }
    return 0;
}

for $name (sort(@names))
{
    if (lc($name) ne lc($oldname)) {
	if (not antigrep($name, @author_names)) {
	    print $name;
	}
    }
    $oldname = $name;
}
