#!/usr/local/bin/perl

# input:   none
# outputs:  a MOMspider instruction file: instruct.MOM
#           
#
### Rob Salgado (salgado@npac.syr.edu) 6 Jul 1995


$TOPURLROOT     = 'http://www.npac.syr.edu/';
$INDEXFILEROOT  = '/usr/local/archives/public/html/';
$EMAIL          = 'salgado';

open(OUT,">instruct.MOM");
open(IN, "ls -F |grep / |") || die "cannot get directories\n";
chmod 0664, 'instruct.MOM';

FILE:
while (<IN>) {
	chop $_;
	($NOSLASH=$_) =~ s/\///;
print  OUT "<Tree\n";
print  OUT "Name        \t$NOSLASH\n";
print  OUT "TopURL      \t$TOPURLROOT$_\n";
print  OUT "IndexURL    \t$TOPURLROOT","MOM-$NOSLASH.html\n";
print  OUT "IndexFile   \t$INDEXFILEROOT","MOM-$NOSLASH.html\n";
print  OUT "EmailAddress\t$EMAIL\n";
print  OUT "EmailBroken\n";
print  OUT "EmailRedirected\n";
print  OUT "EmailChanged\t1\n";
print  OUT ">\n\n";
	next FILE;
}
close(IN);

print  OUT "<Site\n";
print  OUT "Name        \tDocumentRoot\n";
print  OUT "TopURL      \t$TOPURLROOT\n";
print  OUT "IndexURL    \t$TOPURLROOT","MOM-DocumentRoot.html\n";
print  OUT "IndexFile   \t$INDEXFILEROOT","MOM-DocumentRoot.html\n";
print  OUT "EmailAddress\t$EMAIL\n";
print  OUT "EmailBroken\n";
print  OUT "EmailRedirected\n";
print  OUT "EmailChanged\t","1\n";

open(IN, "ls -F |grep / |") || die "cannot get directories\n";
FILE:
while (<IN>) {
	chop $_;
print OUT "Exclude\t","$TOPURLROOT$_\n";
	next FILE;
}
close(IN);
print OUT ">";

close OUT;
exec("ls -l instruct.MOM");





