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

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

while read src dest
do
	if [ ! -f $dest ] ; then
		cp $src $dest
	else
		cat $dest | 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 > $dest
			  cat /tmp/$$ttmaps.dir /tmp/$$ttmaps.dir.add >> $dest
			  rm /tmp/$$ttmaps.dir /tmp/$$ttmaps.dir.add
			)
	fi
done

exit 0

