#!/usr/bin/perl -w
#
# $Revision: 1.4 $ $Date: 2012-07-26 17:11:49-04 $
# $Source: /home/vogelke/bin/RCS/th,v $
# $Host: sys7.com $
# $UUID: 04af461b-064e-3147-9428-2b5718d6cfdf $
#
#< th: look up a word in the thesaurus
# See http://www.gutenberg.org/dirs/etext02/mthes10.zip for source.

use strict;

my @a;
my $fh;
my $thesaurus = "/usr/local/share/dict/mthesaur.txt";
my $arg = shift @ARGV || die "I need a word to look for.\n";

open($fh, "/usr/local/bin/look $arg $thesaurus |") || die "$thesaurus";

while (<$fh>) {
    chomp;
    @a = split(/,/, $_);

    print "$a[0]\n";
    shift(@a);

    foreach (@a) {
        print "   $_\n";
    }
    print "\n";
}

close($fh);
exit(0);
