From: Paul Hänsch Date: Tue, 14 May 2024 10:31:04 +0000 (+0200) Subject: Merge commit '6fdb619bc3d03f6d4877bbf840483e15f8bb6953' X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=919a0cfd686d6cc28b54d823c2e3f37a46a4b2b1;hp=d55c2e8d7ae537ef9f6365ff620a08d3fa7aa79c;p=confetti Merge commit '6fdb619bc3d03f6d4877bbf840483e15f8bb6953' --- diff --git a/cgilite/storage.sh b/cgilite/storage.sh index 17ea0d0..5c61df0 100755 --- a/cgilite/storage.sh +++ b/cgilite/storage.sh @@ -94,6 +94,21 @@ UNSTRING(){ printf '%s\n' "$out" } +RXLITERAL(){ + # sed -E 's;[].*+?^${}()|\[];\\&;g' + local in out='' + [ $# -gt 0 ] && in="$*" || in="$(cat)" + while [ "$in" ]; do case $in in + [.+^\$\{\}\(\)\[\]\*\?\|\\]*) + out="${out}\\${in%"${in#?}"}"; in="${in#?}"; + ;; + *)out="${out}${in%%[.+^\$\{\}\(\)\[\]\*\?\|\\]*}" + in="${in#"${in%%[.+^\$\{\}\(\)\[\]\*\?\|\\]*}"}" + ;; + esac; done + printf '%s\n' "$out" +} + DBM() { local file="$1" cmd="$2" local k v key value