X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=storage.sh;h=355bd569e40779602381612c36fafe6b839f418d;hb=c207699d7f39ce4bf96139e25da61e13cb94be4c;hp=a8484b0514891fe3e7d6f3cfdbb55fba655cb61a;hpb=e3e5c0d0a56dc4de4f7f9e0133e93b2360365eea;p=cgilite diff --git a/storage.sh b/storage.sh index a8484b0..355bd56 100755 --- a/storage.sh +++ b/storage.sh @@ -67,20 +67,11 @@ RELEASE(){ fi } -STRING=' - s;\\;\\\\;g; - s;\n;\\n;g; - s;\t;\\t;g; - s;\r;\\r;g; - s;\+;\\+;g; - s; ;+;g; -' - -STRING_OLD(){ - { [ $# -eq 0 ] && cat || printf %s "$*"; } \ - | sed -E ':X; $!{N;bX;}'"$STRING" -} - +# 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)" @@ -96,7 +87,6 @@ STRING(){ printf '%s' "$out" } - UNSTRING=' :UNSTRING_X s;((^|[^\\])(\\\\)*)\\n;\1\n;g; @@ -107,10 +97,6 @@ UNSTRING=' s;((^|[^\\])(\\\\)*)\\\+;\1+;g; s;\\\\;\\;g; ' -UNSTRING_OLD(){ - { [ $# -eq 0 ] && cat || printf %s "$*"; } \ - | sed -E "$UNSTRING" -} UNSTRING(){ local in out='' [ $# -gt 0 ] && in="$*" || in="$(cat)" @@ -119,7 +105,7 @@ UNSTRING(){ \\n*) out="${out}${BR}"; in="${in#\\n}" ;; \\r*) out="${out}${CR}"; in="${in#\\r}" ;; \\t*) out="${out} "; in="${in#\\t}" ;; - \\+) out="${out}+"; in="${in#\\+}" ;; + \\+*) out="${out}+"; in="${in#\\+}" ;; +*) out="${out} "; in="${in#+}" ;; \\*) in="${in#\\}" ;; *) out="${out}${in%%[\\+]*}"; in="${in#"${in%%[\\+]*}"}" ;;