#!/bin/sh
# derived from index.cgi
# if you click on a command link in both_ports_out_test.html
# you get the name of a script for both_ports_out_test.cgi to run (page
= zzzz)
# and a string (string = xxxx) for the script to deal with
#Decode query string
IFS="&"
for QUERY_PARTS in $QUERY_STRING; do
QKEY="`echo $QUERY_PARTS | cut -d '=' -f 1`"
QVAL="`echo $QUERY_PARTS | cut -d '=' -f 2`"
eval "`httpd -d "$QKEY"`=\"`httpd -d "$QVAL"`\""
#eval "$QKEY=\"$QVAL\""
done
# in case of testing on host
FSROOT=`expr $SCRIPT_FILENAME : '\(.*\)/var/www/cgi-bin/'`
export FSROOT
#Load config
if [ -e /tmp/rs232ws.conf ]; then
. /tmp/rs232ws.conf
else
cp $FSROOT/etc/rs232ws.conf /tmp/rs232ws.conf
. /tmp/rs232ws.conf
fi
# when the page is first opened load the text from pg-default.sh
# this page is addressed like ->
# index.cgi?page=rs232send&string=HARRY
# so the values of both page and string are sent to this script
# thus if page=rs232send the script we run will be pg-rs232send.sh
# has the variable page been given a value?
if [ -e "pg-$page.sh" ]; then
inc="./pg-$page.sh"
# if not then show the default text
else
inc="./pg-cam_default.sh"
page="cam_default"
fi
echo "Content-type: text/html"
echo
#send first part of the html page
cat ../../rs232ws/both_ports_out_test.html
echo "<!-- Content goes here -->"
. $inc
echo "<!-- End of content -->"
echo "Router uptime: `cat /proc/uptime | cut -d ' ' -f 1` seconds.<br>"
# now finish the html
echo "<BR></body></html>"
#cat ../../rs232ws/end.html <-use for a more complex end to the page
|