From bac9dd29ea2542dd8b7e84d2ccaa88179921f25f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 28 Feb 2026 07:24:24 +0200 Subject: bin/u8: Fix byte splitting and variable chaining Turns out I encountered this issue five years ago and reported it. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257702 Closes #2 --- bin/u8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/u8 b/bin/u8 index c022900..c14a974 100755 --- a/bin/u8 +++ b/bin/u8 @@ -23,8 +23,8 @@ # SOFTWARE. # -LC_ALL=C -a=$1 b=${a#?} c=${b#?} d=${c#?} +export LC_ALL=C +a=$1; b=${a#?}; c=${b#?}; d=${c#?} a=${a%"$b"} b=${b%"$c"} c=${c%"$d"} d=${d%"${1#????}"} export $(printf 'a=%d b=%d c=%d d=%d' "'$a" "'$b" "'$c" "'$d") printf '0x%08X\n' "$((a < 128 ? a : a < 224 ? -- cgit v1.2.3