aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2026-02-28 07:24:24 +0200
committerDylan Araps <dylan.araps@gmail.com>2026-02-28 07:24:24 +0200
commitbac9dd29ea2542dd8b7e84d2ccaa88179921f25f (patch)
treed99bd4cf77866bcdfac9fdd56e68e73563ae81f6
parentc30c879ed3db8b733c3841ae6c1d364fd366ad8e (diff)
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
-rwxr-xr-xbin/u84
1 files 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 ?