#!/bin/sh
#
# This file is part of sudognu.
#
# Copyright (C) 2007-2009 Jens Baaran, Germany.
#
# THERE IS NO WARRANTY FOR THIS PROGRAM, TO THE EXTENT PERMITTED
# BY APPLICABLE LAW.
#
# See the GPL Version 2 (http://www.gnu.org/licenses/gpl.html)
# or the file COPYING for details
# ******************************************************************************
set -f
CGISUDOKU=/usr/local/bin/sudognu

cat <<- END
	Content-type: text/html
	
	<html>
	<head>
	  <title>Explaining sudoku solution</title>
	  <style type="text/css">
		body      { background-color:white; color:black; margin-top:4ex; }
	  </style>
	</head>
	<body>
END

PARAM_STRING_SUDOKU=`echo $QUERY_STRING | egrep -o 'sudoku=[[:digit:]]+'`
SUDOKU=`echo $PARAM_STRING_SUDOKU | egrep -o '=[[:digit:]]+' | cut -b 2-`

echo "<h3>The solution of your sudoku is explained step by step.</h3>"
echo "<hr><pre>"
echo $SUDOKU | $CGISUDOKU -s -v 11 -f ./wsudognu.cgi 2>&1
echo "</pre><hr>"

echo "</body>"
echo "</html>"

