#!/bin/sh
# MetaCard 2.4 stack
# The following is not ASCII text,
# so now would be a good time to q out of more
exec mc $0 "$@"
÷
Addresses ! PÁ-- on librarystack
put $QUERY_STRING into theTerms
put "" into buffer
if theTerms = "" then
put "No query submitted." after buffer
else
put 0 into theCt
put theTerms into theTermsArray
split theTermsArray by "&" and "="
put urlDecode(theTermsArray["terms"]) into theSearchWords
put urlDecode(theTermsArray["searchScope"]) into theScope
unmark all cds
if theScope = "byfield" then
delete char 1 to offset("&Fields",theTerms) of theTerms
replace "Fields=" with empty in theTerms
replace "&" with comma in theTerms
put theTerms into theFldList
repeat for each item i in theFldList
mark cds by finding theSearchWords in fld i
end repeat
else -- find in all flds
mark cds by finding theSearchWords
end if
repeat with x = 1 to the number of marked cds
put fld "name" of marked cd x & "
" & cr after buffer
put fld "address" of marked cd x & "
" & cr after buffer
put fld "city" of marked cd x && \
fld "state" of marked cd x && \
fld "zip" of marked cd x & "
" & cr after buffer
put fld "phone" of marked cd x & "
" & cr after buffer add 1 to theCt end repeat end if put "
" before buffer put "