#! /usr/bin/perl
#prints list of usernames (directories) that don't have a $file in them
#file is the parameter
$home="/u/cs/class/cs131/cs131xx";
$file=shift @ARGV;
unless ($file) {
  print "syntax is no-submit submission_filename\ne.g.   non-graded pr1.ss\n";
  exit;
}

@results=`ls $home/`;
@submits=`ls $home/*/$file`;
shift @results while ($results[0] =~ m:[A-Z]:); #my test dirs all start with a CAPITAL letter
chomp @results;
map {s:$home/(\w+)/$file.*:$1:so} @submits;	#strip off all but seas account/directory
shift @submits while ($submits[0] =~ m:[A-Z]:); #my test dirs all start with a CAPITAL letter
foreach $stud (@results) {
  if ($stud eq $submits[0]) {  shift @submits  }	#both in same sorted order
  else {push @nons, $stud;}
}

if (@nons) {  print "The following have not submitted:\n @nons\n";}
else  {  print "All students submitted $file\n";}
