#!/usr/bin/perl -w
#
#NAME
#  MsgReply - handle a reply email message
#
#SYNOPSIS
#  MsgReply [file]..
#
#DESCRIPTION
#
#OPTIONS
#
#EXAMPLES
#
#FILES
#
#BUGS
#
#SEE ALSO
#
#AUTHOR
#  John Chambers <jc@trillian.mit.edu>

$| = 1;
($P = $0) =~ s".*/"";
$V = $ENV{"V_$P"} || 1;
$exitstat = 0;

my $inHdr = 1;
my @Hdr = ();

while ($line = <>) {
	$line =~ s/[\s\r]+$//;
	print "line \"$line\"\n" if $V>5;
	if ($inHdr) {
		if (($tag,$val) = ($line =~ /^([-\w]+):\s*(.*)$/)) {
			print "HDR: \"$line\"\n" if $V>2;
			push @Hdr, "$tag: $val";
		} elsif (($ind,$val) = ($line =~ /^(\s+)\s*(.*)$/)) {
			print "++++ \"$line\"\n" if $V>2;
			$Hdr[$#Hdr] .= " $val";
		} elsif (!$line) {
			print "---- End of headers.\n" if $V>2;
			$inHdr = 0;
			&doHdrs();
		} else {
			print "BAD: \"$line\"\n" if $V>2;
		}
	} else {
		print "TXT: \"$line\"\n" if $V>2;
		if (($tag,$val) = ($line =~ /^(User entered)\s+(.*)/)) {
			print "     Data entered \"$val\"\n" if $V>1;
		} else {
		}
	}
}

exit $exitstat;

sub doHdrs {
	
}

