#
#	licenced_product licence_string product_name
#
#	return	yes/no
#
LIC_STRING=

licutil_licenced_product ()
{
	PRODNAME=$1

	RT_ONLY=no
	case $LIC_STRING in
	  *" rtonly "*)	RT_ONLY=yes ;;
	esac

	case "$PRODNAME" in
	  docsvr)	SEARCH_KEY=docs ;;
	  empperl)	SEARCH_KEY=freeware ;;
	  emptcltk)	SEARCH_KEY=freeware ;;
	  netscape)	SEARCH_KEY=freeware ;;
	  rdbms_rt)	SEARCH_KEY=rdbms ;;
	  jdbc)		SEARCH_KEY=jdbccl ;;
	  rtdccl_dev)	SEARCH_KEY=rtdcsv ;;
	  *)		SEARCH_KEY=$PRODNAME ;;
	esac

	case $LIC_STRING in
	   *" $SEARCH_KEY "*)	;;
	   *)	echo "no" && return;;
	esac

	case $PRODNAME in
	   rdbms)	FL=$PKG_RDBMS
			test "$RT_ONLY" = "yes" && echo "no" && return
			;;
	   rdbms_rt)	FL=$PKG_RDBMS
			test "$RT_ONLY" = "no" && echo "no" && return
			;;
	   docs)	FL=$PKG_DOCS ;;
	   docsvr)	FL=$PKG_DOCSVR ;;
	   odbccl)	FL=$PKG_ODBCCL ;;
	   jdbc)	FL=$PKG_JDBC ;;
	   rtdccl_dev)	FL=$PKG_RTDCCL_DEV ;;
	   ehtml)	FL=$PKG_EHTML ;;
	   empperl)	FL=$PKG_EMPPERL ;;
	   emptcltk)	FL=$PKG_EMPTCLTK ;;
	   netscape)
			if test -f $PKG_NETSCAPE_INFO
			then
				. $PKG_NETSCAPE_INFO
				FL=$CDROM_DIR/$NETSCAPE_FILE
			fi

			test "$FL" = "" && echo "no" && return

			if test -f "$FL"
			then
				echo "yes"
				return
			fi
			;;
	   evaluation)
			echo "yes"
			return ;;
	   *)		echo "no"
			return ;;
	esac

	RV=no
	if test -f "$FL.tgz" || test -f "$FL.tar"
	then
		RV=yes
	fi
	echo "$RV"
}


licutil_licenced_evaluation_deadline ()
{
	case $LIC_STRING in
	   *" evaluation "*)	
		XX=`echo $LIC_STRING | \
                        sed -e 's/.*EDATE/EDATE/' -e 's/@.*//' -e 's/EDATE=//'`
		echo "$XX"
		;;
	esac
}

licutil_licenced_proc_limit ()
{
	case $LIC_STRING in
	   *" rdbms "*)	
		XX=`echo $LIC_STRING | \
                        sed -e 's/.*NPROC/NPROC/' -e 's/ .*//' -e 's/NPROC=//'`
		echo "$XX"
		;;
	esac
}

licutil_print_licinfo ()
{
	clear_screen

	echo_message "$MSG_INSTALL_BANNER2"

	X=`licutil_licenced_evaluation_deadline`
	test "$X" = "" || echo_message "$MSG_EVAL_DATE" "$X"

	X=`licutil_licenced_product beta`
	test "$X" = "yes" && echo_message "$MSG_INFO_BETA"

	X=`licutil_licenced_product rdbms`
	
	if test "$X" = "yes"
	then
		X=`licutil_licenced_proc_limit`

		if test "$X" = "1"
		then
			echo_message "$MSG_SINGLE_USER_LIC"
		else
			echo_message "$MSG_INFO_LIC_LIMIT" "$X"
		fi
	fi

	echo_message "$MSG_INSTALL_PRODUCT_HEADER"

	X=`licutil_licenced_product rdbms`

	if test "$X" = "yes"
	then
		X=`licutil_licenced_product rtonly`

		if test "$X" = "yes"
		then
			echo_message "$MSG_INFO_RDBMS_RT"
		else
			echo_message "$MSG_INFO_RDBMS"
		fi
	fi

	X=`licutil_licenced_product docs`
	Y=`licutil_licenced_product docsvr`

	if test "$X" = "yes" && test "$Y" = "yes"
	then
		echo_message "$MSG_INFO_DOCS_AND_SVR"
	elif test "$X" = "yes"
	then
		echo_message "$MSG_INFO_DOCS"
	else
		echo_message "$MSG_INFO_DOCSVR"
	fi

	X=`licutil_licenced_product odbccl`
	test "$X" = "yes" && echo_message "$MSG_INFO_ODBCCL"

	X=`licutil_licenced_product jdbc`
	test "$X" = "yes" && echo_message "$MSG_INFO_JDBC"

	X=`licutil_licenced_product rtdccl_dev`
	test "$X" = "yes" && echo_message "$MSG_INFO_RTDCCL_DEV"

	X=`licutil_licenced_product ehtml`
	test "$X" = "yes" && echo_message "$MSG_INFO_EHTML"

	X=`licutil_licenced_product empperl`
	test "$X" = "yes" && echo_message "$MSG_INFO_EMPPERL"

	X=`licutil_licenced_product emptcltk`
	test "$X" = "yes" && echo_message "$MSG_INFO_EMPTCLTK"

	X=`licutil_licenced_product netscape`
	if test "$X" = "yes"
	then
		if test -f $PKG_NETSCAPE_INFO
		then
			. $PKG_NETSCAPE_INFO
			echo_message "$MSG_INFO_NETSCAPE" "$NETSCAPE_VERSION"
		fi
	fi
}

