#/usr/local/bin/perl
# ts, boone, 07/27/92
# Search for keywords in Gopher user-visible filenames
# Copyright (C) 1992, Trustees of Michigan State University
#
# Modifications:
# 07/27/92 Boone      Initial coding
# End Modifications
#
# Description:
# Ts searches for a keyword in an index file containing a complete Gopher-style
# directory of a file tree.  The index can be created with the tb program.
# The search is caseless.
# End Description

open(TSLOG, ">>.tslog");
chop($d = `date`);
foreach $i (split(/ /, $ARGV[0]))
{
	print TSLOG "$d $i\n";
	@tlist = `grep -i $i .tsdata`;
	push(@plist, @tlist);
}
foreach $i (@plist)
{
	@fields = split(/\t/, $i);
	$slist{$fields[1]} = $i;
}
foreach $i (sort keys(%slist))
{
	chop $slist{$i};
	print stdout "$slist{$i}\n";
}
print stdout ".\n";
close(TSLOG);