From 01823e0e11b5748074a003f3d2f70175f7613b7f Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 12 Dec 2009 22:27:14 +0000 Subject: [PATCH] =?UTF-8?q?use=20[[=20-o=20=E2=80=A6=20]]=20instead=20of?= =?UTF-8?q?=20[[=20$-=20=3D=20*U*=20]]=20manipulation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dot.mkshrc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/dot.mkshrc b/dot.mkshrc index 2e8c0fb..c7341e0 100644 --- a/dot.mkshrc +++ b/dot.mkshrc @@ -1,5 +1,5 @@ # $Id$ -# $MirOS: src/bin/mksh/dot.mkshrc,v 1.51 2009/11/03 17:58:44 tg Exp $ +# $MirOS: src/bin/mksh/dot.mkshrc,v 1.52 2009/12/12 22:27:14 tg Exp $ #- # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009 # Thorsten Glaser @@ -204,7 +204,7 @@ function pushd { # base64 encoder (not NUL safe) and decoder (NUL safe), RFC compliant function Lb64decode { - typeset u=$- + [[ -o utf8-mode ]]; typeset u=$? set +U typeset c s="$*" t= [[ -n $s ]] || { s=$(cat;print x); s=${s%x}; } @@ -234,14 +234,13 @@ function Lb64decode { t=$t\\x${o#16#} done print -n $t - [[ $u = *U* ]] && set -U - : + (( u )) || set -U } set -A Lb64encode_code -- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \ a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 + / function Lb64encode { - typeset u=$- + [[ -o utf8-mode ]]; typeset u=$? set +U typeset c s="$*" t [[ -n $s ]] || { s=$(cat;print x); s=${s%x}; } @@ -270,14 +269,13 @@ function Lb64encode { t= fi done - [[ $u = *U* ]] && set -U - : + (( u )) || set -U } # DJB cdb hash (not via stdio, for speed) typeset -Z11 -Uui16 Lcdbhash_result function Lcdbhash_add { - typeset u=$- + [[ -o utf8-mode ]]; typeset u=$? set +U typeset s="$*" [[ -n $s ]] || { s=$(cat;print x); s=${s%x}; } @@ -287,8 +285,7 @@ function Lcdbhash_add { ((# Lcdbhash_result = (Lcdbhash_result * 33) ^ 1#${s:(i++):1} )) done - [[ $u = *U* ]] && set -U - : + (( u )) || set -U } function Lcdbhash { Lcdbhash_result=5381 @@ -299,7 +296,7 @@ function Lcdbhash { # Jenkins one-at-a-time hash (not via stdio, for speed) typeset -Z11 -Uui16 Loaathash_result function Loaathash_add { - typeset u=$- + [[ -o utf8-mode ]]; typeset u=$? set +U typeset s="$*" [[ -n $s ]] || { s=$(cat;print x); s=${s%x}; } @@ -311,8 +308,7 @@ function Loaathash_add { ((# Loaathash_result ^= Loaathash_result >> 6 )) done - [[ $u = *U* ]] && set -U - : + (( u )) || set -U } function Loaathash { Loaathash_result=0 # hmm...