#!/bin/sh
echo "Content-type: text/html\n\n"
query="${QUERY_STRING}"
echo "
Search for:
"
terms=$(echo "${query}" | tr '&' '\n' | grep -E "^query" | sed -E 's/^query=//')
if [ -z "$terms" ]; then
exit 0
else
search=$(echo "$terms" | sed -E 's/\%20/ /g')
res=$(./search_repo ./ $search )
if [ -z "$res" ]; then
echo "No results for \"$search\":"
exit 0;
else
echo "
Results for \"$search\""
for r in $res; do
echo "
\n"
done
fi
fi