6 (print "$ARGV[0]: chdir: $!\n"), usage () if !chdir ($ARGV[0]);
12 Checks submission directories for duplicate and otherwise suspicious
15 usage: check-duplicates HWDIR
16 where HWDIR is a directory whose subdirectories contain grade.txt files
17 in the format produced by the submit script.
19 Only subdirectories whose names are entirely alphanumeric are checked,
20 so you can use other names for temporary directories or known
21 duplicate submissions.
28 for my $group (grep (/^[[:alnum:]]+$/, glob ('*'))) {
29 my ($grade) = "$group/grade.txt";
31 open (GRADE, '<', $grade) or (print "$grade: open: $!\n"), next;
34 my ($student) = /\(([[:alnum:]]+)\@stanford.edu\)/ or next;
35 push (@students, $student);
39 print "warning: no students in group $group\n"
41 print "warning: ", scalar (@students), " students in group $group\n"
44 @students = sort @students;
45 for (my $i = 0; $i <= $#students; ) {
46 push (@{$stu2grp{$students[$i]}}, $group);
49 for ($j = $i + 1; $j <= $#students; $j++) {
50 last if $students[$i] ne $students[$j];
54 print "warning: $students[$i] appears $reps times in group $group\n"
60 print "warning: no student named $group in group $group\n"
61 if !grep ($_ eq $group, @students);
66 for my $student (keys %stu2grp) {
67 my (@groups) = @{$stu2grp{$student}};
69 print "warning: $student appears in groups ", join (', ', @groups), "\n";
71 print "Scanned ", scalar (keys (%stu2grp)),
72 " unique students in $group_cnt groups.\n";