#!/bin/csh -f

if ($#argv < 1) then
	echo
	echo "Usage: checkseq <name> "
	echo
	exit -1
endif
@ max = 0
@ min = 999999
foreach i ( `\ls ./$1*.pic` )
	set nohead = $i:t
	set no_pic_ext = $nohead:r
	@ current_count = $no_pic_ext:e
	if ($max < $current_count) then
		@ max = $current_count
	endif
	if ($min > $current_count) then
		@ min = $current_count
	endif
end
@ count = $min
loop:
	if (!(-e $1.$count.pic)) then
		echo "File $1.$count.pic does not exist"
	endif
	@ count++
	if ($count > $max) then
		echo
		echo "FROM $min TO $max"
		echo "Complete ..."
		exit 1
	else
		goto loop
	endif
