#!/usr/bin/perl #Create results file for those who didn't compile #Syntax is same as compile (except no redo) and this script is called by compile $filename=shift @ARGV; #"JCal"; $filename.=".java"; $testfile=shift @ARGV; #"JCTest"; $asgn=shift @ARGV; # "HW1"; if ($asgn eq '') { print "See syntax comments here and in compile\n"; exit; } $home="/u/cs/class/cs131/cs131xx"; $errorfile="$asgn-error"; $errorfileTest="$asgn-errorTest"; $script_dir="$home/$asgn"; $resultsfile="$asgn-results"; $start=shift @ARGV; if (@ARGV) { $files[0]="$start"; #for wraptests seas anything } else { @files=`ls $home/*/$filename`; #get list chomp @files; map {s:$home/(\w+)/$filename:$1:o} @files; #strips off filename so that it is now a directory shift @files while ($files[0]=~ m:[A-Z]:); while ($start && $#files>=0) { #if have starting account then skip past it using shift $start="" if ($files[0] eq $start); shift @files; } } push @commands, "#! /bin/sh\n"; foreach $dir (@files) { unless (-e "$home/$dir/$errorfile") { #no file means no compiliation done print "No compilation done for $dir???\n"; next; } if (-s "$home/$dir/$errorfile") { push @commands, "echo 'Compilaion Errors, see $errorfile\nFinal Score is ' > $home/$dir/$resultsfile\n"; next; } elsif (-s "$home/$dir/$errorfileTest") { push @commands, "echo 'Compilaion Errors on Test, see $errorfileTest\nFinal Score is ' >> $home/$dir/$resultsfile\n"; next; } } #print "@commands"; system "@commands" if $#commands;