X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=cgilite%2Fstorage.sh;h=7f70e6480d6c89c8a32d3a9ee3fb68a5bfcc35b6;hb=HEAD;hp=17ea0d051eaf27233f8b5cd96f7396974c7a87f1;hpb=f0b9c81f51c55f990356f087721f0743706f4867;p=confetti 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