#!/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 -V0 -2 "^$word\$" web.words | sed 's%^.*$%
  • &%' end fi rm $F cnt=`expr "$cnt" + 1` echo "$cnt" >log/wget_counter fi end begin footer hr #echo "There has been $cnt searches in the dictionary since" #echo "27 October 1996." link "about.html" About;echo " this web page." echo "$cnt dictionary lookups and counting." #[ "$CNT" -gt 3 ] && echo "It seems you have used this page at least $CNT times." #echo ':-)' nl begin address link "//www.altocumulus.org/~hallgren/" TH pageend