#!/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 Local Preprint Search Output

Preprint Library Search Results

EOM # Parse year list if [ -z "$QS_search" ]; then echo "Must enter string for search." else if [ "$QS_year" ]; then # Go through list and replace each name by the filename for the # search. # This lets me check the list first, and then respond to # isindex requests. yearlist=`for year_term in $QS_year do case $year_term in 1990) echo '1990' ;; 1991) echo '1991' ;; 1992) echo '1992' ;; 1993) echo '1993' ;; 1994) echo '1994' ;; *) echo ' ' ;; esac done` else yearlist="1994 1993 1992 1991 1990" fi # unescape search string searchname=`$unescape "$QS_search"` export searchname # A single unknown will be interpreted as an ISINDEX search for YEAR in $yearlist do $safeit searchname|lookbib $PREPRINT/$YEAR.bib 2>/dev/null| sed -e 's/ /#/1' -e 's//\>/g' |awk -F# ' BEGIN { found = "0"; Snumber = ""; Dnumber = ""; Vnumber = ""; author = "0" } $1 == "" {if (found == "1") print "

"; next} found == "0" { print "


Matches found in "year".

"} $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 "


No matches found in "year"." }}' year="$YEAR" done echo "
For another search, click" echo "here." fi # else # #.. The script was called without a query. # Provide an ISINDEX type response for browsers # without form support. # cat << EOM Content-type: text/html Preprint Gateway

Theoretical Physics Preprint Library

This (simplified) service will search a database of preprints which have been sent to the theoretical preprint library, and which are kept in the lunchroom off the Department of Physics main office. The title and up to three authors are entered for each paper and the papers are grouped into 6 subjects: AS astrophysics, FT field theory, GP general physics, GR general relativity, PP particle physics, SS solid state. Each paper is assigned a number of the form subject-year-number. Simply type the text that you wish to search for (case insensitive, can be more than one word). All available years are searched.

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 < Address software problems to

The Web Master (theoryweb@physics.ubc.ca)
Software written by
Steve Braham (braham@physics.ubc.ca)
EOM