#!/bin/sh
#
#ident  "@(#)i.ttmapsdir 1.8 04/04/28 SMI"
#
# Copyright (c) 1994 by Sun Microsystems, Inc.
#

PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH

while read src dst
do
	if [ ! -f $dst ] ; then
		cat $src > $dst
	else
		cat $dst | sed -e '1d' > /tmp/$$ttmaps.dir
		cat $src  | sed -e '1d' > /tmp/$$ttmaps.dir.add
		diff -w /tmp/$$ttmaps.dir /tmp/$$ttmaps.dir.add | \
		grep '^>' > /dev/null && (
			count=`grep '^FILENAME' /tmp/$$ttmaps.dir \
					/tmp/$$ttmaps.dir.add | wc -l`
			echo $count > $dst
			cat /tmp/$$ttmaps.dir /tmp/$$ttmaps.dir.add >> $dst
		)
		rm /tmp/$$ttmaps.dir /tmp/$$ttmaps.dir.add
	fi
done

exit 0
