X-Git-Url: https://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=storage.sh;h=22e6accbcba7cddd75bbaec0235a174b4aa53bd3;hp=77ee29c06243eae9359c03125626a46f498cded4;hb=e02243e96d7cc400b63c3e856d0e80d4140c6805;hpb=07b4b96f662c7649130701b27865a851488ee2f7 diff --git a/storage.sh b/storage.sh index 77ee29c..22e6acc 100755 --- a/storage.sh +++ b/storage.sh @@ -66,11 +66,6 @@ RELEASE(){ fi } -# STRING=' -# s;\\;\\\\;g; s;\t;\\t;g; -# s;\n;\\n;g; s;\r;\\r;g; -# s;\+;\\+;g; s; ;+;g; -# ' STRING(){ local in out='' [ $# -gt 0 ] && in="$*" || in="$(cat)" @@ -83,19 +78,9 @@ STRING(){ " "*) out="${out}+"; in="${in# }" ;; *) out="${out}${in%%[\\${CR}${BR} + ]*}"; in="${in#"${in%%[\\${BR}${CR} + ]*}"}" ;; esac; done - printf '%s' "$out" + printf '%s' "${out:-\\}" } -UNSTRING=' - :UNSTRING_X - s;((^|[^\\])(\\\\)*)\\n;\1\n;g; - s;((^|[^\\])(\\\\)*)\\t;\1\t;g; - s;((^|[^\\])(\\\\)*)\\r;\1\r;g; - s;((^|[^\\])(\\\\)*)\+;\1 ;g; - tUNSTRING_X; - s;((^|[^\\])(\\\\)*)\\\+;\1+;g; - s;\\\\;\\;g; -' UNSTRING(){ local in out='' [ $# -gt 0 ] && in="$*" || in="$(cat)" @@ -109,7 +94,7 @@ UNSTRING(){ \\*) in="${in#\\}" ;; *) out="${out}${in%%[\\+]*}"; in="${in#"${in%%[\\+]*}"}" ;; esac; done - printf '%s' "$out" + printf '%s\n' "$out" } DBM() {