#!/bin/sh

# tico: intrusion compensation of Tape/Pvm traces
# compensated output trace may not be chronologically
# sorted.
#
# Eric Maillet, 1995
#
# 18/12/95, maillet: updated for trace format introduced with 0.9pl8
# 18/03/96, maillet: updated for SIMMODE options
#           sm minimal simulation
#           sf full simulation

TapeSort="sort +5n -6 +6n -7 +1n -2"

# filename is expected to be last of list

i=1
for a
  do
    if [ $i -ne $# ] ; then
      ARGLIST="$ARGLIST $a"
    else
      FILE=$a
    fi
    i=`expr $i + 1`
done

# do some checking and perform tape_ic

if [ $FILE != "-" -a ! -f $FILE ]
then
    >&2 echo `basename $0`: could not find trace file \"$FILE\"
    exit 3
fi

if [ $FILE != "-" ]
then
    VersionLine="`head -1 $FILE` [tico]"
else
    VersionLine='# TAPE/PVM event file [tico]'
fi

echo $VersionLine
$TapeSort $FILE | tape_ic $ARGLIST - | grep -v CorrEvt
 
