# Uncomment to debug as standalone script
# #!/usr/bin/tcsh
# set GETOPT="/usr/bin/getopt"

#
# Getopt for tcsh and wi,csh
#   Source: http://frodo.looijaard.name/project/getopt/misc/examples
#

set dataid = 0
set project = ""

set tempopt=(`"$GETOPT" -s tcsh -o d:p: -- $argv:q`)
if ($? != 0) then 
  echo "Terminating (tcsh getopt)..." >/dev/stderr
  exit 1
endif

eval set argv=\($tempopt:q\)


while (1)
	switch($1:q)
	case -p:
                # echo "Option n, argument "\`$2:q\' 
                set project = "$2:q"
                shift ; shift
		breaksw;
	case -d:
                # echo "Option n, argument "\`$2:q\' 
                set dataid = "$2:q"
                shift ; shift
		breaksw;
	case -1:
                set dataid = 1
                shift ; shift
		breaksw;
	case -2:
                set dataid = 2
                shift ; shift
		breaksw;
        case --:
		shift
		break
	default:
		echo "Internal error!" ; exit
	endsw
end
