#!/bin/sh # # A Hypertext Ortho Gateway for the CGI interface of an httpd deamon # # Version 0.0 19 Apr 94 # # This script relies on the Ortho from Tomasz Kowaltowski, # Claudio Luchesi and Jorge Stolfi # # QUERIES # # An accompanying HTML Form sets up the query and allows all the functionality # of ortho to be set explicitly. # # PORTING NOTES # # This script should work on almost all systems with a bourne shell, awk. # **** **** **** **** CONFIGURABLE VARIABLES **** **** **** **** MaqSunOS=atibaia read QUERY_STRING ORTHODIR=${STOLFIHOME}/PUB # **** **** **** **** NO CONFIGURATION NEEDED BELOW **** **** **** **** # if [ -x $ORTHODIR ]; then # #.. To support an ISINDEX type search, set query string if given # an argument on the command line # if [ "$QUERY_STRING" = "" ]; then PREFIX="file=" fi # #.. Check that a query has been made # if [ "$QUERY_STRING" ]; then # #.. Strip the variables out from the query string, # and assign them into the environment, prefixed by 'QS_' # # o sed removes any ' that would upset quoted assignment # # o awk ensures that # - all variables passed have legal names # - special characters are not interpreted by sh # eval `echo $PREFIX$QUERY_STRING | sed -e 's/'"'"'/%27/g' | \ awk 'BEGIN{RS="&";FS="="} $1~/^[a-zA-Z][a-zA-Z0-9_]*$/ { printf "QS_%s=%c%s%c\n",$1,39,$2,39}' ` # #.. Set the search type # case $QS_code in tt*) OPT_code='tt-' ;; tex*) OPT_code='tex-' ;; iso*) OPT_code='' ;; esac # #.. Set the output contents # case $QS_out in Erradas+com+alternativas) OPT_out='-alt' ;; Todas+com+alternativas) OPT_out='-allwrong' ;; Apenas+erradas) OPT_out='' ;; esac # #.. Output header # # cat << EOM Content-type: text/html