#!/bin/sh
#
# File:    validdiff
# Purpose: to show gvim diff and also execute internal PC^2 Validator
#
# $HeadURL: http://pc2.ecs.csus.edu/repos/pc2v9/branches/PC2_RELEASE_9_2_x/samps/scripts/validiff $
# $Id: validiff 2090 2010-04-10 19:28:54Z laned $
#
# Directions
# Add/Edit Problem | Validator Tab 
# Select Use External Validator
# Validator Command Line must be: {:infile} {:outfile} {:ansfile} {:resfile} 
# 

if [ -f EXITCODE.TXT ]; then
cat >$4<<EOM
<?xml version="1.0"?>
<result outcome =  "No - Run-time Error" security = "$4">Team execution exited non-zero, this is a possible run-time error
</result>
EOM
cat >>$2<<EOM

EOM
echo -n "PC2: Team program exit code = " >> $2
cat EXITCODE.TXT >> $2
else 
java -cp /usr/pc2v9/lib/pc2.jar edu.csus.ecs.pc2.validator.Validator $* -pc2 1 true

# This may no be done in all contests, use as necessary.
# result=$4
# cat $result | sed 's/No - Wrong Answer/No - Incorrect Output/' > ${result}.new && mv ${result}.new $result
fi

if [ ! -f /root/computer ];  then
   gvim -d $2 $3 > /dev/null
fi

# eof validiff $Id: validiff 2090 2010-04-10 19:28:54Z laned $
