#!/bin/bash # wget.cgi - WWW gateway to Webster's English Dictionary. # Author: Thomas Hallgren # http://www.cse.chalmers.se/~hallgren/ # For non-commercial use only. AUTOHEADER=no . bin/cgistart.sh title="Webster's English Dictionary" CNT=`count_cookie wget_visits` echo "Set-Cookie: wget_visits=$CNT; expires=31-dec-2049 23:59:59 GMT" cnt=`cat log/wget_counter` cnt=${cnt:-0} cgiheaders echo >>log/wget_log "${REMOTE_HOST-$REMOTE_ADDR} _ _ ["`date "+%d/%b/%Y:%H:%M:%S %Z"`"] $HTTP_USER_AGENT [$CNT visits]" q=$(qparse "$QUERY_STRING" word) word=$(echo "$q" | plain2html) case "$word" in "") thistitle="$title";; *) thistitle="$title: $word" esac logo=`imgalt "/Img/book09.gif" "" "class=right"` #doctype_html40loose pagestart "$thistitle" "$logo $title" begin main begin form echo Enter the word to look up: tag "input name=word value=\"$word\"" end if [ -n "$word" ]; then h2 "$word" F=/tmp/wget$$ if webster "$word" >$F ; then begin pre whtml <$F end else echo "$word wasn't found in the dictionary, but here are" echo "some similar words:" begin dir agrep -2 "^$word\$" web.words | sed 's%^.*$%