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

usage()
{
   $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 [ -z "$1" ]
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

#
# These variables are used to echo a string without a newline
#

if [ $OS_TYPE = sol23 -o $OS_TYPE = sol24 ]
then
   ECHO=/usr/bin/echo
else
   ECHO=echo
fi

if [ $OS_TYPE = linux -o $OS_TYPE = sun ]
then
   DASHN="-n"
   BACKC=
else
   DASHN=
   BACKC="\c"
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
