#!/bin/sh # # A Hypertext Preprint searcher # Gateway for the CGI interface of an httpd deamon # using the archie interface as a base # #.. To support an ISINDEX type search, set search string if given # an argument on the command line # if [ $# -gt 0 ]; then PREFIX="search=" fi # #.. Check that a query has been made # if [ $QUERY_STRING ]; then PREPRINT=/disk1/usr/home/preprint safeit=/usr/local/http/support/safeitgr unescape=/usr/local/http/support/unescape # #.. 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 # # This is modified so that section is parsed and built up as # a list. # Also have a fix for Lynx-it sends + encoded, rather than plain, # so we convert it back again if we see it. # # First a security strip search SAFE_QUERY=`$safeit QUERY_STRING` eval `echo $PREFIX$SAFE_QUERY | sed -e 's/'"'"'/%27/g' \ -e 's/%20/+/g'| awk 'BEGIN{RS="&";FS="="; yearlist = ""; yf="0"} $1 == "year" && yf == "0" { yearlist=$2; yf="1"; next} $1 == "year" { yearlist = yearlist" "$2; next} $1~/^[a-zA-Z][a-zA-Z0-9_]*$/ { printf "QS_%s=%c%s%c\n",$1,39,$2,39} END{ if (yf == "1" ) printf "QS_year=%c%s%c\n",39,yearlist,39}' ` # #.. Output header # cat << EOM Content-type: text/html
"; next} found == "0" { print "
"}
$1 ~ /S/ {Snumber = $2; found = "1" ; next}
$1 ~ /D/ {Dnumber = $2; next}
$1 ~ /V/ {Vnumber = $2; next}
$1 ~ /T/ {
print ""$2"
";
print "Ref: "Snumber"/"Dnumber"/"Vnumber"
";
author = "0";
next}
$1 ~ /A/ && author == "0" {
print "Author(s):";
print ""$2"";
author = "1";
next}
$1 ~ /A/ && author == "1" {
print ", "$2""}
END { if (found == "0") {
print "
Any questions, suggestions, comments, or problems with the
contents of the list can be sent to the
preprint librarian (Scott Hayward) at extension 2-6144, or via email
to preprint@physics.ubc.ca.
EOM
fi
cat <