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

print("What kind of bug report is this?\n");
print("1) Holodeck\n2) Transporter\n3) General\n");
do{
$n = &input();
if($n eq "1"){
	$type = "holodeck";
}
elsif($n eq "2"){
	$type = "transporter";
}
elsif($n eq "3"){
	$type = "enterprise";
}
}until(defined($type));

&makeheader();
&getcomments("What were you trying to do?\n");
&getcomments("What's wrong:\n");
&getcomments("What should have happened:\n");
&getcomments("Please describe any relevant documentation references:\n");

&sendit();


sub input {
        local($foo);
        print(">>>");
        $foo = <STDIN>;
        chop($foo);
        $foo;
}

sub makeheader {
	$who = `whoami`;
	chop($who);
	$when = `date`;
$msg = "*------$type Bug Report\n";
$msg .= "System Name:\t\t$type.ncc1701d.sf.ufp\n\n";

}
sub getcomments {
	local($q) = @_;
	print("\nEnd with a . on a line by itself.\n");
	print($q);
	$msg .= "\n$q";
	while($line ne ".\n") {
		$msg = $msg.$line;
		$line = (<STDIN>);
	}
	$line = "";
}
sub sendit {
	print(STDERR "Sending...");
	open(MAILOUT, "|mhmail bug-$type@beacon -subject $type-bug-report");
	print MAILOUT "$msg";
	print(STDERR "done.\n");
}

