From ed3fecb0e3063d2812a082ea46afc33bb4b58820 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 18 Jul 2018 07:53:23 +0200 Subject: [PATCH] various -a flags for grep --- cgilite | 2 +- index.cgi | 10 +++++----- indexmeta.sh | 6 +++--- style.css | 7 ++----- widgets.sh | 4 ++-- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/cgilite b/cgilite index d214859..fcb3e20 160000 --- a/cgilite +++ b/cgilite @@ -1 +1 @@ -Subproject commit d214859aadb31a565718da69754ad2573fa3f917 +Subproject commit fcb3e2096bd811a910c686bbfe181708878ba8b4 diff --git a/index.cgi b/index.cgi index d6535e7..1b305e4 100755 --- a/index.cgi +++ b/index.cgi @@ -9,15 +9,15 @@ file_pattern='^.*\.(mov|ts|mpg|mpeg|mp4|m4v|avi|mkv|flv|sfv|wmv|ogm|ogv|webm|iso FILTER="$(GET f)" SEARCH="$(GET s)" -ORDER="$(GET o |grep -m1 -xE 'Date|Name|Length' || printf Name)" -LISTSIZE="$(COOKIE pagesize |grep -m1 -xE '[1-9][0-9]*' || printf 50)" +ORDER="$(GET o |grep -m1 -axE 'Date|Name|Length' || printf Name)" +LISTSIZE="$(COOKIE pagesize |grep -m1 -axE '[1-9][0-9]*' || printf 50)" ITEM="$(PATH "${PATH_INFO#/}")" case $(GET a) in setprefs) - SET_COOKIE +$((86400 * 90)) pagesize="$(POST pagesize |grep -m1 -xE '[1-9][0-9]*' || printf 50)" - SET_COOKIE +$((86400 * 90)) mode="$(POST mode |grep -m1 -xE 'browse|index' || printf browse)" - SET_COOKIE +$((86400 * 90)) fakemp4="$(POST fakemp4 |grep -m1 -xE 'yes' || printf no)" + SET_COOKIE +$((86400 * 90)) pagesize="$(POST pagesize |grep -m1 -axE '[1-9][0-9]*' || printf 50)" + SET_COOKIE +$((86400 * 90)) mode="$(POST mode |grep -m1 -axE 'browse|index' || printf browse)" + SET_COOKIE +$((86400 * 90)) fakemp4="$(POST fakemp4 |grep -m1 -axE 'yes' || printf no)" REDIRECT "$(POST ref)" ;; esac diff --git a/indexmeta.sh b/indexmeta.sh index 4545df9..2ac459f 100644 --- a/indexmeta.sh +++ b/indexmeta.sh @@ -69,7 +69,7 @@ meta_info(){ if [ -d "${meta%/meta}" ]; then grep -aF " $(meta_name "$file")" "$meta" \ - | grep -m1 -xE '[0-9]+ [0-9]+ [0-9]+ tags=[^ ]* comment=[^ ]* .+' \ + | grep -m1 -axE '[0-9]+ [0-9]+ [0-9]+ tags=[^ ]* comment=[^ ]* .+' \ || meta_file "$file" else printf '0\t0\t0\ttags=\tcomment=\t\r' @@ -84,7 +84,7 @@ meta_dir(){ if [ -d "$dir/.index" -a \! -f "$meta" ] && LOCK "$meta"; then touch "$meta" # preliminary touch to prevent concurrent generators find "$dir" -type f -mindepth 1 -maxdepth 1 \ - | grep -E "$file_pattern" \ + | grep -aE "$file_pattern" \ | while v="$(line)"; do meta_line "$v" done >"$meta" @@ -93,7 +93,7 @@ meta_dir(){ elif [ -d "$dir/.index" -a "$dir" -nt "$meta" ] && LOCK "$meta"; then touch "$meta" find "$dir" -type f -mindepth 1 -maxdepth 1 \ - | grep -E "$file_pattern" \ + | grep -aE "$file_pattern" \ | while v="$(line)"; do if [ "$v" -nt "$meta" ]; then grep -qF " $(meta_name "$v")" "$meta" \ diff --git a/style.css b/style.css index 0eba517..14e37a0 100644 --- a/style.css +++ b/style.css @@ -1,6 +1,7 @@ * { box-sizing: border-box; margin: 0; padding: 0; + text-align: left; } button { padding: .125em .5em; } a { color: inherit; text-decoration: none;} @@ -32,7 +33,6 @@ body { position: relative; overflow: hidden; height: 0; - text-align: left; background-color: #333; } #prefs:target, @@ -125,7 +125,6 @@ a[href="#advsearch"]:before { line-height: 2em; background-color: inherit; border-bottom: 1px solid; - text-align: left; padding-left: .5em; position: relative; top: -2em; @@ -136,7 +135,6 @@ a[href="#advsearch"]:before { padding: .5em 1em; background-color: #444; line-height: 1.5em; - text-align: left; } #advsearch input.and {display: none;} @@ -169,7 +167,6 @@ a[href="#advsearch"]:before { min-width: 200px; min-height: 12em; overflow: hidden; - text-align: left; vertical-align: top; } @@ -278,6 +275,7 @@ a[href="#advsearch"]:before { background-color: #4F4; } +.itemlist, .pagination { display: block; text-align: center; @@ -293,7 +291,6 @@ a[href="#advsearch"]:before { } #editing { - text-align: left; width: 100%; background-color: #333; border-top: 1px solid; diff --git a/widgets.sh b/widgets.sh index ead4c7c..ce1813c 100644 --- a/widgets.sh +++ b/widgets.sh @@ -105,7 +105,7 @@ w_advsearch(){ $n "$category" "$t" "$lbid" "$lbid" "$category" $n printf '%s\n' "$w_tags" \ - | { [ "$category" = '*' ] && grep -vF ':' |grep -vxF '' || grep -wF "${category}"; } \ + | { [ "$category" = '*' ] && grep -avF ':' |grep -avxF '' || grep -awF "${category}"; } \ | while read -r tag; do t=''; [ ! "${f%%*|${tag}|*}" ] && t=checked printf '[option %s value="%s"\n%s]' "$t" "$tag" "${tag#*:}" @@ -136,7 +136,7 @@ w_tagging(){ | while read -r category; do printf '[fieldset [legend %s:][select name=tag size=4 multiple' "$category" printf %s "$w_tags" \ - | { [ "$category" = 'Tags' ] && grep -vF ':' | grep -vxF '' || grep -wF "${category}"; } \ + | { [ "$category" = 'Tags' ] && grep -avF ':' | grep -avxF '' || grep -awF "${category}"; } \ | while read -r tag; do printf '[option value="%s"\n%s]' "$tag" "${tag#*:}" done -- 2.39.2