#!/bin/csh -f
#+
# lastframe -- reset frameno to overwrite the last image
#
# Purpose:
#	Checks for the highest-numbered image in the current output
#	directory, and set FRAMENO keyword to that value.  The next
#	image taken will overwrite this image.
#
# Usage:
#	lastframe
# 
# Arguments:
#	none
# 
# Output:
#	none
# 
# Example:
#       1) To overwrite the previous image, enter:
#             lastframe
#-
# Modification history:
#	Date unknown	???	Original version
#	2000-Jul-01	GDW	Added commments
#       2002-Jun-06     GDW     Adapted for DEIMOS
#-----------------------------------------------------------------------

set buf = $0
set cmd = $buf:t
set usage = "Usage: $cmd"

# verify args...
if ( $#argv > 0 ) then
  printf "$usage\n"
  exit 1
endif

# check for last image...
set lastfile = `lastfile`
if ( $status ) exit $status

# reset frameno...
modify -s deiccd frameno = $lastfile