#sccs	"@(#)term513:Remove	1.10"

LIST0="async_main umodem"
LIST1="ELD.ft BLD.ft VBM.ft SCLD.ft UK.ft ROMC.ft ROMG.ft"
LIST2="te.hlp"


# check if async_ma is an active process

ps -e | grep async_ma | \
  while read PID TTY TIME COMMAND
do
	if [ "$COMMAND" = "async_ma" ]
	then	
	message -i "Currently someone is using ATE, therefore; this ATE REMOVE will not take place."
	exit 64
	fi
done

if [ $? = 64 ]
then
	exit 64
fi

echo "               Updating Suffixes file ..."

uaupd -r "Modem Profile" Suffixes
uaupd -r "RS-232 Profile" Suffixes

echo "               Updating Comm_pkgs file ..."

uaupd -r ATE_Modem Comm_pkgs
uaupd -r ATE_Serial Comm_pkgs

# Test if update comm_packages file exist
# if file exist, EXEC /etc/cpupd to inform phone manager to update comm packages

if [  -f /etc/cpupd ]
then
	/etc/cpupd
fi


echo '               Removing ATE...'

for i in $LIST2
do

	rm -f /usr/lib/ua/$i
done

for i in $LIST0
do

	rm -f /usr/bin/$i
done

# restore foundation version of fonts if needed

for i in $LIST1
do
	mv /usr/lib/wfont/.$i.tmp /usr/lib/wfont/$i 2>/dev/null
done

# restore foundation version of umodem

mv /usr/bin/.umodem.tmp /usr/bin/umodem 2>/dev/null

