gph-poll

a dynamic poll for geomyidae(8)
git clone git://src.adamsgaard.dk/gph-poll # fast
git clone https://src.adamsgaard.dk/gph-poll.git # slow
Log | Files | Refs | LICENSE Back to index

commit aa5c7ea58b105b98a0c47a56e78233314ae58c86
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue, 30 Mar 2021 12:21:22 +0200

Add blank poll and LICENSE

Diffstat:
ALICENSE | 16++++++++++++++++
Aindex.dcgi | 32++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,16 @@ +ISC License + +Copyright (c) 2021 Anders Damsgaard <anders@adamsgaard.dk> +Copyright (c) 2021 Christoph Lohmann <20h@r-36.net> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/index.dcgi b/index.dcgi @@ -0,0 +1,32 @@ +#!/bin/sh + +search="$1" +arguments="$2" +host="$3" +port="$4" + +polldb="cancellist.db" +polldescription="description.txt" +polldir="poll" + +# TODO: Lock access for database trimming. +if [ -n "${search}" ]; then + tmpdb="$(mktemp)" + tail -n 99 "${polldb}" > "${tmpdb}" + printf "%s\n" "${search}" | expand -t 4 >> "${tmpdb}" + mv "${tmpdb}" "${polldb}" +fi + +if [ -r "$polldescription" ]; then + cat "$polldescription" +fi + +printf '\n' +printf '[7|New choice: _______|/%s|server|port]\n\n' "$polldir" +printf 'Ranking:\n\n' + +sort "${polldb}" \ + | uniq -c \ + | sort -nr + +printf '\n[1|<< back|/|server|port]\r\n'