#!/bin/sh

# **** **** **** **** NO CONFIGURATION NEEDED BELOW **** **** **** ****

#
#
#..	To support an ISINDEX type search, set query string if given
#	an argument on the command line
#
    if [ $# -gt 0 ]; then 
	PREFIX="query="
    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}' `
    fi
#
#..	do the job...
#
