diff --git a/check.t b/check.t index 6c2fe0f..4666dab 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.274 2009/05/16 15:53:00 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.275 2009/05/16 16:03:41 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -5203,13 +5203,14 @@ stdin: typeset -Uui16 -Z11 pos=0 typeset -Uui16 -Z7 hv typeset -i1 wc=0x0A + typeset -i lpos dasc= nl=${wc#1#} - integer n while IFS= read -r line; do line=$line$nl - while [[ -n $line ]]; do - wc=1#${line::1} + lpos=0 + while (( lpos < ${#line} )); do + wc=1#${line:(lpos++):1} if (( (wc < 32) || \ ((wc > 126) && (wc < 160)) )); then dch=. @@ -5218,11 +5219,10 @@ stdin: else dch=${wc#1#} fi - if (( (pos & 7) >= 7 )); then + if (( (pos & 7) == 7 )); then dasc=$dasc$dch dch= - fi - if (( (pos & 7) == 0 )); then + elif (( (pos & 7) == 0 )); then (( pos )) && print "$dasc|" print -n "${pos#16#} " dasc=' |' @@ -5231,7 +5231,6 @@ stdin: print -n "${hv#16#} " (( (pos++ & 7) == 3 )) && \ print -n -- '- ' - line=${line:1} dasc=$dasc$dch done done