#!/usr/bin/env perl # -*- mode: Perl;-*- # Version 4.20.8 # See the file COPYING in the main distribution directory for copyright notice. unshift (@INC, '/home/ff/cs61b/grading-software/share/lib'); require "GradingBase.pl"; CmndLine ("", 1, 2); require "GradingCommon.pl"; my $assgn = shift; my $patn = shift; if (! AssignmentExists ($assgn)) { Fatal ("Error: assignment $assgn not found."); } $me = MyLogin (); if ($patn) { CheckPatn ($patn) || Fatal ("'$patn' is not a valid regular expression pattern."); } else { if (! ReaderExists ($me)) { Fatal ("No pattern supplied and you are not registered as a reader."); } $loginPatn = $READER_ASSIGNMENTS{$me}; } opendir (SUBMISSIONS, "$SUBMISSION_DIR/$assgn") || Fatal ("No submissions for $assgn."); while (defined ($subm = readdir (SUBMISSIONS))) { $file = "$SUBMISSION_DIR/$assgn/$subm"; if (not -f $file or IsPartnerSubmission ($file)) { next; } ($login) = ($subm =~ /([^.]+)\./); if (($patn && $subm =~ /^$patn$/o) || ($loginPatn && "${assgn}::$login" =~ /$loginPatn/o)) { if (-e $subm) { Warn ("File $subm already exists"); } else { symlink ($file, $subm) || Warn ("Could not create link to $subm."); } unlink ("ok-$subm", "problem-$subm"); if (-e "$LOG_DIR/$assgn/ok/$subm") { symlink ("$LOG_DIR/$assgn/ok/$subm", "ok-$subm") || Warn ("Could not create link to log file."); } elsif (-e "$LOG_DIR/$assgn/failed/$subm") { symlink ("$LOG_DIR/$assgn/failed/$subm", "problem-$subm") || Warn ("Could not create link to log file."); } else { Warn ("No log found for $subm."); } } } closedir (SUBMISSIONS); exit 0;