# spellout - a utility to compare words to a hashed word list for `spell'.
# Copyright 1999 Nathan Scott Thompson ( quimby at city-net dot com )
# You may use this according to the GNU Public License: see http://www.gnu.org

use Spelling;
use strict;

my $Duplicates;

if ( $ARGV[0] eq '-d' )
{
    $Duplicates = 1;
    shift;
}
my $filename = shift or die "usage: $0 [ -d ] hashfile [ file ] ...\n";
open( IN, $filename ) or die "Can't open $filename: $!\n";
my $list = Hlist->new( FileHandle => \*IN )
    or die "Bad hashed word list: $filename\n";
close IN;

while ( <> )
{
    /\S+/ or next;
    print "$&\n" unless ( $list->contains( $& ) ^ $Duplicates );
}
