diff options
-rwxr-xr-x | search_cgi | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -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 |