summaryrefslogtreecommitdiff
path: root/search_cgi
diff options
context:
space:
mode:
authorKatolaZ <[email protected]>2020-01-11 06:31:28 +0000
committerKatolaZ <[email protected]>2020-01-11 06:31:28 +0000
commit5546d8dd8efb00d05dc463ae01d011c591fd11ea (patch)
tree81f48e1d89a8dac87cd4c3e1a7d7b27bb46cf35b /search_cgi
parent665f032bba52391a3cd9f654efac16e3a9183bbf (diff)
fix several small output problems
Diffstat (limited to 'search_cgi')
-rwxr-xr-xsearch_cgi30
1 files changed, 15 insertions, 15 deletions
diff --git a/search_cgi b/search_cgi
index 969b070..b6dccfe 100755
--- a/search_cgi
+++ b/search_cgi
@@ -2,31 +2,31 @@
##func
printlines (){
- echo "<ul>\n"
+ printf "<ul>\\n"
l=$(echo "$@" | tr ' ' '\n')
for r in $l; do
- echo "<li><div><a href=\"$r\" >$r</a></div></li>\n"
+ printf "<li><div><a href=\"%s\" >%s</a></div></li>\\n" "$r" "$r"
done
- echo "</ul>\n"
+ printf "</ul>\\n"
}
-printf "Content-type: text/html\n\n"
query=$(echo "${QUERY_STRING}" | sed -E 's/["\\$^?<>@;*`|/()]//g')
##func
print_head(){
+ printf "Content-type: text/html\\n\\n"
echo "<html><head><style type='text/css'>"
echo "body{padding: 20px; margin: 40px auto;line-height: 1.6;font-size: 18px; color:#444;}"
echo "</style></head>"
echo "<body><div>Search for: </div><form method='GET' action='/cgi-bin/search_cgi'>"
echo "<div><input type='text' name='query' autofocus /></div>"
- echo "<div>in: <input type='radio' name='type' id="type_url" value='url' checked><label for="type_url">url</label>"
- echo "<input type='radio' name='type' id="type_descr" value='descr' /><label for="type_descr">description</label>"
- echo "<input type='radio' name='type' id="type_readme" value='read' /><label for="type_readme">readme</label>"
- echo "<input type='radio' name='type' id="type_all" value='all' /><label for="type_all">all</label>"
+ echo "<div>in: <input type='radio' name='type' id='type_url' value='url' checked /><label for='type_url'>url</label>"
+ echo "<input type='radio' name='type' id='type_descr' value='descr' /><label for='type_descr'>description</label>"
+ echo "<input type='radio' name='type' id='type_readme' value='read' /><label for='type_readme'>readme</label>"
+ echo "<input type='radio' name='type' id='type_all' value='all' /><label for='type_all'>all</label>"
echo "</div>"
echo "<input type='submit' value='Search!' />"
echo "</form>"
@@ -61,10 +61,10 @@ if [ -n "$terms" ]; then
"--DESCR")
if [ -n "$curstr" ]; then
if [ -n "$results" ]; then
- printf "<div>%s results in repo %s</div>\n" $numres $curstr
+ printf "<div>%s results in repo %s</div>\\n" $numres $curstr
printlines "$results"
else
- printf "<div>No results in repo %s</div>\n" $curstr
+ printf "<div>No results in repo %s</div>\\n" $curstr
fi
fi
results=""
@@ -80,10 +80,10 @@ if [ -n "$terms" ]; then
#echo "$line<br>"
if [ -n "$curstr" ]; then
if [ -n "$results" ]; then
- printf "<div>%s results in repo %s</div>\n" $numres $curstr
+ printf "<div>%s results in repo %s</div>\\n" $numres $curstr
printlines "$results"
else
- printf "<div>No results in repo %s</div>\n" $curstr
+ printf "<div>No results in repo %s</div>\\n" $curstr
fi
fi
results=""
@@ -103,10 +103,10 @@ if [ -n "$terms" ]; then
done
if [ -n "$curstr" ]; then
if [ -n "$results" ]; then
- printf "<div>%s results in readme files</div>\n" $numres
- printlines $results
+ printf "<div>%s results in readme files</div>\\n" $numres
+ printlines "$results"
else
- printf "<div>No results in readme files </div>\n" $curstr
+ printf "<div>No results in readme files </div>\\n"
fi
fi
fi