#!/bin/sh

echo "Content-type: text/html"
echo "Status: 200"
echo ""

#HEAD="  <A HREF=\"/\">
#		<IMG SRC="/images/IMMD4-logo-24x24.gif" ALT=\"IMMD IV Home Page\"></A>
#	<A HREF=\"/Services/Info\">
#		<IMG SRC=\"/images/Pictograms/arrow-S-N.gif\" ALT=\"Up\"></A>
#	<I><A HREF=\"/~eirich/\">Thomas Eirich</A>, 
#		23.11.93</I>
#	<HR><P>"

HEAD=`/proj/i4/bin/mkhtml ++arrows -home -flag +up /Services/Info/Drucken/ +person roessler -onlyheader`

case "$QUERY_STRING" in
printer=*)
    printer=`echo "$QUERY_STRING" | sed -e 's/^printer=//'`

    /proj/i4/bin/mkhtml ++arrows -home -flag +up /Services/Info/Drucken/ \
     +person roessler -onlyheader +title "$printer: Printer status"

    cat <<-EOT
    <H1>Status for printer $printer</H1>
      <PRE>
      `/local/lpd/bin/lpq -P$printer`
      </PRE>
      <HR>
      </BODY>
      </HTML>
EOT
      ;;
*)
    /proj/i4/bin/mkhtml ++arrows -home -flag +up /Services/Info/Drucken/ \
     +person roessler -onlyheader +title "Query Printer Status"

    cat <<-EOT
	<H1>Query the Status of a  Printer</H1>
	<FORM>
	Enter printer name: <INPUT SIZE=20 NAME="printer"><P>
	</FORM>
	<HR>
	</BODY>
	</HTML>
EOT
	;;
esac
