:
#	@(#) setpref 23.2 91/08/29 
#
#	Copyright (C) 1990-1991 The Santa Cruz Operation, Inc.
#		All Rights Reserved.
#	The information in this file is provided for the exclusive use of
#	the licensees of The Santa Cruz Operation, Inc.  Such users have the
#	right to use, modify, and incorporate this code into other products
#	for purposes authorized by the license agreement provided they include
#	this notice and the associated copyright notice with any such product.
#	The information in this file is provided "AS IS" without warranty.
#

OALIB=${OALIB-"/usr/lib/oa2"}
PATH=$OALIB/utilbin:$PATH

# why is this needed???
stty sane tab3

 # run ourself thru oash 
eval oainit 2>/dev/null || (oash $0; kill $$)
. `findfile shell_strs`

EscWasHit() { 
	oadeinit
	rm -f $TEMP
	exit
}

TEMP=/tmp/fm1$$

#SETPREF1="SCO Calendar"
#SETPREF2="SCO Mail"
#SETPREF3="SCO Manager"
#SETPREF4="Usage: ${0} {calendar,mail,desktop}"
case $1 in
	calendar)	file=.caln_pref
			prog=$SETPREF1;;
	mail)		file=.mail_pref
			prog=$SETPREF2;;
	desktop)	file=.desk_pref
			prog=$SETPREF3;;
	*)		echo $SETPREF4
			EscWasHit;;
esac

#SETPREF5="       **Permission denied**"
#SETPREF9='Set ${prog} Preferences'
if test ! -w $OALIB/$file; then
	echo $SETPREF5 > $TEMP
	wmopen 1 3 40 10 19 
	eval wmtitle \"$SETPREF9\" 
	wmmessage -r "$USEARROW"
	scan -e"$EOFMSG" $TEMP 
	EscWasHit
fi

#SETPREF10='
#      If you select Yes, then your current
#      preferences for ${prog} will become
#      the system-wide defaults.
#      '

#SETPREF6="Set System-wide Preferences"
#SETPREF7="Yes"
#SETPREF8="No"

wmopen 1 9 45 5 19 
wmtitle "$SETPREF6" 
eval echo \"$SETPREF10\" 
wrefresh 1


newwin 2 1 14 11 33 
wmove 2
pp "$SETPREF7" "$SETPREF8"
[ "$PP_NUM" -eq -1 ] && EscWasHit

set $PP_ITEM; CHOICE=$1
if test "$CHOICE" != "$SETPREF7"; then
	EscWasHit
fi
if test -r $HOME/$file; then
	cp $HOME/$file $OALIB/$file
fi

EscWasHit
