#!/usr/bin/perl -w
# Try to htmlize and pack up the logs of surveys that were processed before the
# processing tools were htmlized.
use DRAORed qw(checklogd mvlogww survey);
sub recursivesetuplogs{
if (-d "LOGS") {
system("mv LOGS/* .");
rmdir "LOGS";
}
if (-d "logs") {
unless(-f "logs/index.html"){
system("mv logs/* .");
rmdir "logs";
}
}
my @subdirs = split /\n/, `find . -maxdepth 1 -type d`;
foreach my $sd (@subdirs) {
# print "subdir = $sd\n";
unless($sd eq "." or $sd eq "./logs"){
chdir $sd;
# print "Now running recursivesetuplogs . for $sd\n";
# print "pwd is ";
# print `pwd`;
recursivesetuplogs();
chdir "..";
}
}
print "recursivesetuplogs starting checklogd in ";
print `pwd`;
my @loge = <*.LOG>;
if (@loge) {
my $dummy = checklogd("dummy");
}
}
my $surv = survey();
if($surv eq "-1"){
die "doing this in the current directory seems unwise";
}
recursivesetuplogs();
# Check for confusionremoval.log. If found, reconstruct the command line of
# each paragraph. and put it in logs/index.html.
# # Check that it makes sense to run this before rming a lot of files.
# if [ -f ipc/CONVD.MI21 ] ; then
# echo "Are you SURE you want to tar and rm? (y/n)"
# read ans
# if [ "$ans" = "y" ] ; then
# echo "tarring..."
# tar cfz ceo.tar.gz --remove-files ceo || echo "tp: Error tarring ceo!"
# tar cfz gains.tar.gz --remove-files gains || echo "tp: Error tarring gains!"
# # tar cfz logs.tar.gz logs [qu]/*/logs ipc/logs && rm -rf logs [qu]/*/logs ipc/logs || echo "Error tarring logs!"
# tar cfz logs.tar.gz --remove-files logs [qu]/*/logs ipc/logs || echo "Error tarring logs!"
# echo "rming..."
# rm -f [qu]/*/*.M?21
# rm -f [qu]/*/*.P21
# rm -f *.TBL_DAT
# echo "tp done!"
# else
# echo "OK...not doing anything."
# fi
# else
# echo "ipc/CONVD.MI21 not found. Check that you are in the right directory"
# echo "and REALLY want to run tp."
#fi