#ident	"@(#)pkg4.i386:scde/request	1.1"
trap 'trap 1 2 3 15; exit 3' 1 2 3 15
#-------
# This request script sets the parameter CORESIDENT for the use of the
# other installation scripts.
# Its value is "y" if there is an existing compilation system we have
# to make coresident with the one being installed.
# Otherwise, its value is "n".
#-------

#-------
# This part examines whether there is a version of cc that we can
# relocate.
#-------

CORESIDENT=n

OCC=/bin/cc
if	[ -x "$OCC" ]
then
	case "`$OCC -V </dev/null 2>&1`"
	{
	*"C Software Development System 4."*	|\
	*"C Compilation System, Issue 4.1"*	|\
	*"C Compilation System, Issue 4.2"*	)
		CORESIDENT=y
		;;
	}
fi

#-------
# If there is one, then ask how to set CORESIDENT.
# Otherwise, don't bother the poor user.
#-------

HELP="If you answer in the affirmative, any existing header files
in /usr/include in conflict with files in this package
will be relocated to /usr/occs/include.
 A new /usr/bin/cc will be generated which will preferentially use
the relocated include files.
 If you answer in the negative, conflicting header files
will be overwritten, and the existing C Compilation System
may no longer function.
 ~"

PROMPT="Do you wish to make the existing C Compilation System
coresident with the new C Compilation System?
 ~"

if	[ "$CORESIDENT" = y ]
then
	ans=`ckyorn		\
		-d y		\
		-h "$HELP"	\
		-p "$PROMPT"`	|| exit $?

	case "$ans"
	{
	[yY]*)	CORESIDENT=y			;;
	[nN]*)	CORESIDENT=n			;;
	*)	echo Internal Error!; exit 1	;;
	}
fi

cat >${1:-/dev/tty} <<!
CORESIDENT='$CORESIDENT'
!

exit 0
