#!/bin/csh -f
#
# This program uses grep (yuck!) to find the start end and by values
# from and sdl file.
# It returns the three values by printing them to stdout (which can be
# converted into a list in a csh program
#
# If the SDL file is not animated, then in returns 1 1 1
#
umask 000
if (-e $1 ) then
    set NT_ANIM=`grep "animation  = TRUE;" $1`

    if ( "GAMMA${NT_ANIM}" == "GAMMA" ) then
        #
        # Here we know the sdl is not animated
        #
        echo "1 1 1"
    else
        set TMPFILE=/usr/tmp/tmp.$$
        grep "startframe =" $1 > ${TMPFILE}
        set NT_START_STRING=`cat ${TMPFILE}`
        grep "endframe   =" $1 > ${TMPFILE}
        set NT_END_STRING=`cat ${TMPFILE}`
        grep "byframe    =" $1 > ${TMPFILE}
        set NT_BY_STRING=`cat ${TMPFILE}`
        /bin/rm ${TMPFILE}

        set NT_START=`basename ${NT_START_STRING[3]} ';'`
        set NT_END=`basename ${NT_END_STRING[3]} ';'`
        set NT_BY=`basename ${NT_BY_STRING[3]} ';'`

        echo "${NT_START} ${NT_END} ${NT_BY}"
    endif
else
    echo "1 1 1"
endif 
