#!/bin/sh
#
# Usage: ishdecrypt [a|d] input-file
#
# Options:
#	a: authenticate digital signature
#	d: decrypt
#
# Description:
# 	Passes the input file through pgp
#

ECHO=echo

usage()
{
   $ECHO ""
   $ECHO "Usage: ishdecrypt [a|d] input-file"
   $ECHO "   a    : authenticate digital signature"
   $ECHO "   d    : decrypt"
   $ECHO ""
   $ECHO "*** Press return to continue ***"
   read ANS
}

#
# Check arguments
#

if [ $# -eq 0 ]; then
   usage
   exit 1
fi

ARGS="-m"
case $1 in
   a|d) shift;;
esac

#
# Make sure there is a file name
#

if [ -z "$1" ]
then
   usage
   exit 1
fi

#
# Run the command and save the status
#

$ECHO "pgp $ARGS $*"
pgp $ARGS $*
PGPSTAT=$?

#
# Allow user to confirm
#

$ECHO ""
$ECHO ""
$ECHO "*** Press return to continue ***"
read ANS

#
# Display signed data if present
#
if [ ! -z $2 ]
then
   if [ ! -z $PAGER ]
   then
      $PAGER $2
   else
      more $2
   fi
fi

exit $PGPSTAT
