#!/bin/sh 

# Update the saved log file.  Normally, only update logfile in 'save'.
# In the case of a complete reinstrumentation, may want to add in 
# /usr/tmp/GCTLOG, which records how GCT executes when it instruments
# itself.

PATH=/usr/new/bin:$PATH
export PATH

mv /usr/tmp/GCTLOG /usr/tmp/GCTLOG.save

echo "Retain contents of /usr/tmp/GCTLOG?"
read answer
if [ "y" = "$answer" ]
then
    gmerge save/GCTLOG /usr/tmp/GCTLOG.save > /usr/tmp/GCTLOG.tmp
    gct-newlog save/gct-map.self /usr/tmp/GCTLOG.tmp > /usr/tmp/GCTLOG
    /bin/rm /usr/tmp/GCTLOG.tmp
else
	gct-newlog save/gct-map.self save/GCTLOG > /usr/tmp/GCTLOG

	gsummary /usr/tmp/GCTLOG > /tmp/NEW
	gsummary -test-map save/gct-map.self save/GCTLOG > /tmp/OLD
	diff /tmp/OLD /tmp/NEW	# Should be identical, or expected differences
fi
exit 
