###############################################################
#
# File Name   : LICENSE
#
# Description : Displays license info and checks
#
# Date        : 12/03/1997
#
###############################################################

TERM=vt100
export TERM

echo
echo "Press <RETURN> to view the PGP End User License Agreement: \c"
read REPLY

base=${INST_DATADIR}
name=${PKG}

LICENSE="$base/$name/reloc/$name/docs/LICENSE"

size=`cat $LICENSE | wc -l`

rows=`tput lines`

tputok=0

if [ $rows -eq 0 ]
then
     rows=23
else
     rows=`expr $rows - 1`
     tputok=1
fi

counter=0

while [ $counter -lt $size ] 
do
    counter=`expr $counter + $rows`
    head -$counter $LICENSE | tail -$rows
    if [ $counter -lt $size ]
    then
             if [ $tputok -eq 1 ]
             then
                  tput rev
                  echo "Press <RETURN> to continue:\c"
                  tput sgr0
             else
                  echo "\t****** Press <RETURN> to continue: \c"
             fi
         read REPLY
    fi
done

while [ 1 ]
do
      echo
      echo "Do you agree with the terms of this license [Y/N]:\c"
      read reply

      case $reply in
           Y|y)
                break
                ;;
           N|n)
                exit 3
                ;;
           *)
                continue 
                ;;
      esac
done


##################################

exit 0
