#!/bin/sh -ea # wget.cgi - WWW gateway to Webster's English Dictionary. # Author: Thomas Hallgren # http://www.cs.chalmers.se/~hallgren/ # For non-commercial use only. PATH=./bin:/usr/local/bin:$PATH #LD_LIBRARY_PATH=./lib echo Content-type: text/html CNT=`./count_cookie wget_visits` echo "Set-Cookie: wget_visits=$CNT; expires=31-dec-2009 23:59:59 GMT" cnt=`cat wget_counter` echo echo >>wget_log "$REMOTE_ADDR _ _ ["`date "+%d/%b/%Y:%H:%M:%S %Z"`"] $HTTP_USER_AGENT [$CNT visits]" echo "Webster's English Dictionary $*" echo "

" echo "Webster's English Dictionary

" echo '' if [ $# != 0 ]; then echo "

$*

" F=/tmp/wget$$ if webster "$*" >$F ; then echo '
'
    whtml <$F
    echo '
' else echo "$* wasn't found in the dictionary, but here are" echo "some similar words:" echo "" agrep -2 -x "$*" lib/webster/web.words | sed 's%^.*$%
  • &%' echo "
  • " fi rm $F echo "
    " cnt=`expr $cnt + 1` echo $cnt >wget_counter fi #echo "There has been $cnt searches in the dictionary since" #echo "27 October 1996." #[ "$CNT" -gt 3 ] && echo "It seems you have used this page at least $CNT times." #echo ':-)' echo '

    About this web page.' echo '

    TH'