#!/bin/sh

TAIL=/usr/bin/tail
SED=/usr/bin/sed

echo Content-type: text/html
echo

hostname=`hostname`

if [ -x $TAIL ]; then
	if [ $# = 0 ]; then
		cat << EOM
<HTML>
<HEAD><TITLE>View modem log</TITLE></HEAD>
<BODY BACKGROUND="/images/tiles/stdtile3.jpg">
<H1>View modem log</H1>

<ISINDEX>

This is a form for viewing the modem log of a modem on dialup1.
Type the modem port name in your browser's search dialog to
view the log of that modem.
<P>
<A HREF="http:/staff">
<IMG SRC="/images/home.gif" ALT=""></A>
<A HREF="http:/staff">Return to Staffroom</A>
</FONT>
</BODY>
</HTML>
EOM
	else
		port="$*"
		echo "<HTML>"
		echo "<HEAD><TITLE>View log of modem $port</TITLE></HEAD>"
		echo "<BODY BACKGROUND=\"/images/tiles/stdtile3.jpg\">"
		echo "<H1>View log of modem $port<HR></H1>"
		echo "<FONT=+3>"
		echo "<PRE>"
		rsh dialup1 $TAIL -50 /tmp/log_mg.$port
		echo "</PRE>"
		echo "<P>"
		echo "<A HREF=\"http:/staff\">"
		echo "<IMG SRC=\"/images/home.gif\" ALT=\"\"></A>"
		echo "<A HREF=\"http:/staff\">Return to Staffroom</A>"
		echo "</FONT>"
		echo "</BODY>"
		echo "</HTML>"
	fi
fi
