#!/usr/bin/perl

# Compile the games file.

use CGI;
$q = new CGI;

$gameslocation = "~gregstoll/tex/davidgames";

print $q->header, $q->start_html('Compiled'), $q->h1('Compilation results');

#$command = "cd $gameslocation";
#@output =`$command`;
#print $q->p("Output of $command:"), $q->p(@output);

$command = "cd $gameslocation && latex --interaction=nonstopmode $gameslocation/Games.tex";
@output =`$command`;
print $q->p("Output of $command:"), $q->p(@output);

$command = "cd $gameslocation && latex --interaction=nonstopmode Games.tex";
@output =`$command`;
print $q->p("Output of $command:"), $q->p(@output);

$command = "cd $gameslocation && makeindex Games 2>&1";
@output =`$command`;
print $q->p("Output of $command:"), $q->p(@output);

$command = "cd $gameslocation && latex --interaction=nonstopmode Games.tex";
@output =`$command`;
print $q->p("Output of $command:"), $q->p(@output);

$command = "cd $gameslocation && dvips Games.dvi 2>&1";
@output =`$command`;
print $q->p("Output of $command:"), $q->p(@output);

print $q->end_html;
