tindex.dcgi - gph-poll - a dynamic poll for geomyidae(8) | |
git clone git://src.adamsgaard.dk/gph-poll | |
Log | |
Files | |
Refs | |
README | |
--- | |
tindex.dcgi (801B) | |
--- | |
1 #!/bin/sh | |
2 | |
3 search="$1" | |
4 arguments="$2" | |
5 host="$3" | |
6 port="$4" | |
7 | |
8 polldb="poll.db" | |
9 polldescription="description.txt" | |
10 | |
11 if [ -n "${search}" -o "${arguments}" ]; then | |
12 tmpdb="$(mktemp)" | |
13 if [ -r "$polldb" ]; then | |
14 tail -n 99 "${polldb}" > "${tmpdb}" | |
15 fi | |
16 printf "%s%s\n" "${search}" "${arguments}" \ | |
17 | expand -t 4 >> "${tmpdb}" | |
18 cat "${tmpdb}" > "${polldb}" | |
19 fi | |
20 | |
21 printf '\n' | |
22 | |
23 if [ -r "$polldescription" ]; then | |
24 cat "$polldescription" | |
25 printf '\n' | |
26 fi | |
27 | |
28 if [ -r "$polldb" ]; then | |
29 printf 'Ranking:\n\n' | |
30 sort "${polldb}" \ | |
31 | uniq -ci \ | |
32 | sort -nr \ | |
33 | while read -r count option; do | |
34 printf '[1|(%s) %s|./%s?%s|server|port]\n' \ | |
35 "$count" "$option" "${SCRIPT_NAME}" "$option" | |
36 done | |
37 fi | |
38 | |
39 printf '\n[7|Add new choice: _______|./%s|server|port]\n' "${SCRIPT_NAME… | |
40 | |
41 printf '\n[1|<< back|/|server|port]\n' |