#!/bin/sh
#
#ident  "@(#)r.ttmaps.dir 35.1 96/06/25 SMI"
#
# Copyright (c) 1996 by Sun Microsystems, Inc.
#

cat > /tmp/$$ttmaps.dir.delete  << EOF
FROM-ENCODING iso8859-1
TO-ENCODING unicode
FILENAME iso8859-1.ttmap
FROM-ENCODING iso8859-2
TO-ENCODING unicode
FILENAME iso8859-2.ttmap
FROM-ENCODING symbol
TO-ENCODING unicode
FILENAME symbol.ttmap
FROM-ENCODING dingbats
TO-ENCODING unicode
FILENAME dingbats.ttmap
EOF

while read dest
do
	if [ -f $dest ] ; then
		cat $dest | sed -e '1d' > /tmp/$$ttmaps.dir
		diff /tmp/$$ttmaps.dir /tmp/$$ttmaps.dir.delete | \
			grep '^<' | sed -e 's/^< //' > /tmp/$$ttmaps.dir.new
		count=`grep '^FILENAME' /tmp/$$ttmaps.dir.new | wc -l`
		if [ $count -eq 0 ]; then
			rm  $dest
		else
			echo $count > $dest
			cat /tmp/$$ttmaps.dir.new  >> $dest
		fi
		rm /tmp/$$ttmaps.dir /tmp/$$ttmaps.dir.delete \
			/tmp/$$ttmaps.dir.new
	fi
done

exit 0

