#!/usr/bin/perl

use Text::Tabs;

print "Content-Type: text/plain\n\n";

%formdt = split /[&=]/, $ENV{QUERY_STRING};
#foreach (keys %formdt) {
#    print "$_: $formdt{$_}\n";
#}

@temp_arg_name = split /,/, $formdt{detemp} if defined $formdt{detemp};
open F, $formdt{filename} or die;

while (<F>) {
    $_ = expand($_);
    if (defined $formdt{detemp}) {
	next if (m#^template#);
	foreach $tan (@temp_arg_name) {
	    s#<$tan>##g;
	    s#$tan#double#g;
	    s#<double>##;
	}
    }
    if (defined $formdt{remove}) {
	next if (m#//\#$formdt{remove}$#);
    }
    print;
}

close F;

