#!/usr/local/bin/perl -w
use Getopt::Std;

sub usage { <<EOF
Usage: $0 treestem teststem
	Where 'treestem' is like 'ecaux/1M-full-train-25'
	and 'teststem' is like 'fixed1/full-main-25'
EOF
}

my %opt;
getopts('h', \%opt);

@ARGV || die usage();
$opt{h} && die usage();

my $treestem = shift;  # e.g. ecaux/1M-full-train-25
my $teststem = shift;  # e.g. fixed1/full-main-25
my $arch = $ENV{ARCH};
my $test = "/u/dpb/nlp/c4.5-$arch/Src/test";

$treestem =~ s/^(.*\/)(.*)/$2/;
my $treedir = $1;
$teststem =~ s/^(.*\/)(.*)/$2/;
my $testdir = $1;
#chomp(my $curdir = `pwd`);
#$treedir = $curdir . '/' . $treedir unless '/' eq substr($treedir, 0, 1);
#$testdir = $curdir . '/' . $testdir unless '/' eq substr($testdir, 0, 1);

my $outfile = "$teststem.$treedir$treestem.output";
$outfile =~ tr{/}{-};
$outfile = $testdir . $outfile;

exec ("$test -f $treedir$treestem -t $testdir$teststem.data > $outfile");
