#!/usr/bin/sh
#
# M. Hayes      2/28/97
#
# This script maintains the simulation counter.  Currently, there are
# 5 sets of data for each command.  This can be modified to support
# more sets of data.  The counter resets itself so the the simulation
# data is cyclical.
#

RM=/usr/bin/rm

COUNTER=`cat $1/simcounter.dat`
if [ $2 = "RESET" ];
then
    ${RM} $1/simcounter.dat;
    echo 0 > $1/simcounter.dat;
elif [ $COUNTER -eq 5 ]; 
then
    ${RM} $1/simcounter.dat;
    echo 0 > $1/simcounter.dat;
else
    COUNTER=`expr $COUNTER + 1`
    ${RM} $1/simcounter.dat;
    echo "$COUNTER" > $1/simcounter.dat;
fi 
