Shell Client
Source Code
#!/bin/ksh
# 2004, Michael Doran
# University of Texas at Arlington Libraries
#
# Quick hack -- proof of concept -- not for production
this_script="schedule.cgi"
remote_server="[voyager server]"
remote_script="/cgi-bin/roomstext.cgi"
# Grab include files for "look & feel"
head0=`cat ../header.txt`
head1=`cat ../another.txt`
tail0=`cat ../footer.txt`
# Parse form data (in a very crude way)
case "$REQUEST_METHOD" in
GET)
query_string=${QUERY_STRING}
;;
POST)
read standard_input
query_string=`echo ${standard_input} | sed -e 's/&submit=+Go+//'`
;;
esac
# Start outputting the HTML page
/usr/bin/echo "Content-type: text/html\n\n${head0}\n"
echo '<a class="nav" href=".">Short Loans Schedule</a> > Enhanced Group Study Rooms'
/usr/bin/echo "${head1}\n"
# Get schedule and display -- this seems to work
(/usr/bin/echo "GET ${remote_script}?${query_string} HTTP/1.0 \n\n"
sleep 10) | \
telnet ${remote_server} 80 | \
sed -e '/^Trying/,/^Connection: close$/d' | \
sed -e '/^Content-Type/d' | \
sed -e "s#${remote_script}#${this_script}#"
/usr/bin/echo "\n${tail0}"
exit 0