]> git.plutz.net Git - serve0/commitdiff
use argument parsing from cgilite
authorPaul Hänsch <paul@plutz.net>
Sun, 12 Sep 2021 18:05:07 +0000 (20:05 +0200)
committerPaul Hänsch <paul@plutz.net>
Sun, 12 Sep 2021 18:05:07 +0000 (20:05 +0200)
index.cgi

index 1b84d2f436f149a742e11494b592c27a3e9a7b0b..f625199d035a76049e316a7ca03912b0138712eb 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -1,18 +1,9 @@
 #!/bin/sh
 
 exec 2>/dev/null
 #!/bin/sh
 
 exec 2>/dev/null
-for n in "$@"; do case ${n%%=*} in
-  data) _DATA="${n#data=}";;
-  exec) _exec="${n#exec=}";;
-  noerr) exec 2>&-;;
-esac; done
-
-[ -z "${_EXEC%/}" ] && _EXEC="$(realpath "${0%/*}")" || _EXEC="${_EXEC%/}"
-[ -z "${_DATA%/}" ] && _DATA=. || _DATA="${_DATA%/}"
-
 file_pattern='^.*\.(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|ogv|webm|iso|rmvb)$'
 
 file_pattern='^.*\.(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|ogv|webm|iso|rmvb)$'
 
-. "$_EXEC/cgilite/cgilite.sh"
+. "${_EXEC:-${0%/*}}/cgilite/cgilite.sh"
 
 FILTER="$(GET f)"
 SEARCH="$(GET s)"
 
 FILTER="$(GET f)"
 SEARCH="$(GET s)"