]> git.plutz.net Git - confetti/commitdiff
helper functions for checking item selections
authorPaul Hänsch <paul@plutz.net>
Sun, 8 Dec 2019 22:14:24 +0000 (23:14 +0100)
committerPaul Hänsch <paul@plutz.net>
Sun, 8 Dec 2019 22:14:24 +0000 (23:14 +0100)
index.cgi

index 43abf5ddcc288383965904aeb496eb5cd94e3a15..093a5c4a90051bb87e717c6619c7cffd6cde997a 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -18,6 +18,9 @@ ACTION="$(GET a)"
 message="$(COOKIE message)"
 [ "$message" ] && SET_COOKIE 0 message=''
 
+checked(){  [ "$1" = "$2" ] || [ "$1" -eq "$2" ] && printf 'checked="checked"' 2>/dev/null; }
+selected(){ [ "$1" = "$2" ] || [ "$1" -eq "$2" ] && printf 'selected="selected"' 2>/dev/null; }
+
 yield_page() {
   local class="$1" style="$2"
   printf 'Content-Type: text/html; charset=utf-8\r\n\r\n'