#!/bin/sh
ecc="echo"
ecs="\c"
if [ "`(echo "test\c";echo "test") | wc | awk '{print $1}'`" != "1" ]
then
	ecc="echo -n"
	ecs=""
fi
$ecc "Checking font files ..."$ecs
havepcf="T"
havesnf="T"
havefb="T"
havebdf="T"
for file in *.bdf
do
   if [ -f $file ]
	then
		break
	else
		havebdf=""
		break
	fi
done
for file in *.pcf
do
   if [ -f $file ]
	then
		break
	else
		havepcf=""
		break
	fi
done
for file in *.snf
do
   if [ -f $file ]
	then
		break
	else
		havesnf=""
		break
	fi
done
for file in *.fb
do
   if [ -f $file ]
	then
		break
	else
		havefb=""
		break
	fi
done
echo " done."
#if [ "$havefb" = "T" ]
#then
#	echo ""
#	echo "You could remove the font files *.fb *.ff and *.list if"
#	echo "you don't use Xnews."
#	$ecc "Remove *.fb *.ff *.list ? [y/n] "$ecs
#	read rmanswer
#	if [ "$rmanswer" = "Y" -o "$rmanswer" = "y" -o "$rmanswer" = "" ]
#	then
#		rm -f *.fb *.ff *.list
#	fi	
#fi
if [ "$havesnf" = "T" -a -f "fonts.dir" -a "`grep -c '\.snf' fonts.dir`" = "0" ]
then
	echo "Removing the snf font files (not needed)."
	rm -f *.snf
fi
if [ "$havepcf" = "T" -a -f "fonts.dir" -a "`grep -c '\.pcf' fonts.dir`" = "0" ]
then
	echo "Removing the pcf font files (not needed)."
	rm -f *.pcf
fi
