:
#	%Z% %M% %I% %E% %Q%
#
#	Copyright (C) The Santa Cruz Operation, 1988, 1989, 1990.
#	This Module contains Proprietary Information of
#	The Santa Cruz Operation, and should be treated as Confidential.
#
# set the standard exit values
: ${OK=0} ${FAIL=1} ${STOP=10}

getyn() {
	while	echo "\n$* (y/n) \c">&2
	do	read yn rest
		case $yn in
		[yY])	return $OK 			;;
		[nN])	return $FAIL			;;
		*)	echo "Please answer y or n" >&2	;;
		esac
	done
}

err_msg="
    ERROR: Password change Failed.
           The password database is in danger of being in an undefined state.
           It is recommended that you verify that the time is set correctly.
           Answering yes to the following question will allow you to do this.
"

#main

# don't allow del'ing out until password is set
trap '' 1 2 3 15

getyn "Do you wish to set the system password at this time ? " || exit $STOP

while :
do
	#Create the super-user password
	if su root -c "/bin/passwd root"
	then
		exit $OK
	else
		echo $err_msg >&2
		if getyn "Would you like to try again?"
		then
			asktimerc
		else
			exit $FAIL
		fi
	fi
done
exit $OK
