#!/bin/csh -f

set progname = `basename $0`
set path = ($path /vol/lab/bin) #for errecho!
setenv HANDIN /vol/vlsi/local/handin

if ($#argv < 2) then
  errecho "${progname}: usage: $progname [<cadgroup> <exno>]1+"
  exit 1
endif

while ($#argv >= 2)
  set cadgroup = $1
  set raw_exno = $2
  shift ; shift

  set handin_loc = $HANDIN/$cadgroup
  set exercise = $raw_exno #they could be different in a system with names, say
  if ($status) then
    errecho ${progname}: $cadgroup exercise $raw_exno not found
    # but don't exit!
  else if (!(-d $handin_loc/$exercise) && !(-f $handin_loc/$exercise.CRUSHED)) then
    errecho "${progname}: cannot find directory for $cadgroup exercise $exercise"
    # but don't exit!
  else if (-f $handin_loc/.lock.$exercise) then
    echo $cadgroup exercise $exercise is LOCKED.
  else
    echo $cadgroup exercise $exercise is UNLOCKED.
  endif
end #while

if ($#argv) then
  errecho "${progname}: unknown argument $* at end"
  exit 1
endif
