#!/usr/bin/perl
# mailpgp -- part of PinePGP distribution
# copyright (c) 1996, Jan M. Kujawa
# kujawa@montana.com

$EDIT=$ENV{'EDITOR'};
$SIGN='-sat';
$SIGNENCRYPT='-esa';
$ENCRYPT='-sa';
$HOME=$ENV{'HOME'};
$return_value=fork;
if( $return_value == 0 ) { #child
   `rm -f $HOME/.mailpgp/mailpgp.out.asc`; #make sure output file is dead
   exec "$EDIT $ARGV[0]" ||die "unable to spawn edit process.\n";
}
elsif ( $return_value != 0 ) { #parent
   wait; 
#hoo-kay, do stuff.
print "MENU:\n";
print "   1:  Sign the message\n";
print "   2:  Sign and Encrypt the message\n";
print "   3:  Encrypt the message\n";
print "   else:  do nothing to the message\n";
$response=getc;
	if($response==1)
	{
	print "Signing...\n";
	exec "pgpdriver $SIGN $ARGV[0]";
	}
	elsif($response==2)
	{
	print "Signing and Encrypting...\n";
	exec "pgpdriver $SIGNENCRYPT $ARGV[0]";
	}
	elsif($response==3)
	{
	print "Encrypting...\n";
	exec "pgpdriver $ENCRYPT $ARGV[0]";
	}
	else
	{
	#GNDN
	}
}
else { #error
   die "fork-ing errors.  scheiBe.\n";
}

