#!/afs/athena/contrib/perl/perl

$url = shift @ARGV;
$time = time;
$fname = "url.$$.$time";
@ARGV = (0..250);

open(URLFILE, ">>/mit/mkgray/afs/w4/net.Index/$fname");
print URLFILE $url;
print URLFILE "\n";
close(URLFILE);

chdir('/mit/mkgray/afs/w4/net.Index');
$output = `/mit/mkgray/afs/w4/net.Index/fast250.pl $fname $fname`;

unlink("/tmp/$fname");
chdir("/usr/tmp/$fname");
while(<>){
    next unless /http/;
    ($http, $nil, $host) = split;
    push(@hosts, $host) unless $hsts{$host};
    $hsts{$host}=1;
}
$fnamehosts = "$fname"."hosts";

open(HLIST, ">>/tmp/$fnamehosts");
for $h (@hosts){
    print HLIST "$h\n";
}
close(HLIST);

$addlist = `/mit/mkgray/project/comprehensive/addlist.pl /tmp/$fnamehosts`;
$newindex = `/mit/mkgray/project/comprehensive/stripindex.pl /usr/tmp/$fname/index $fname`;
