use [[ -o … ]] instead of [[ $- = *U* ]] manipulation
This commit is contained in:
parent
769e222586
commit
01823e0e11
22
dot.mkshrc
22
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 <tg@mirbsd.org>
|
||||
@ -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...
|
||||
|
Loading…
x
Reference in New Issue
Block a user