commit 8f68c932a42402d913542c4f081ee6fd8bca855e
parent 105bc38364b9d16d6b56be08b568a011fbc4a6ec
Author: phoebos <ben@bvnf.space>
Date: Fri, 8 Jul 2022 00:51:30 +0100
uxnsolve: support version 2
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/uxnsolve b/uxnsolve
@@ -1,6 +1,6 @@
#!/bin/sh -e
-VERSION=1
+VERSION=2
[ "$#" -eq 2 ] || {
printf "usage: %s file.tal.debug address\n" "$0" >&2
@@ -30,7 +30,8 @@ source_file="${1%.debug}"
check_versions() {
read -r v < "$1"
- if [ "$v" != "$VERSION" ]; then
+ # version 2 is compatible with version 1 for this tool
+ if [ "$v" != "$VERSION" ] && [ "$v" != 1 ]; then
printf "${yellow}ERROR${reset}: incompatible version '%s' (this tool is version %d)\n" "$v" "$VERSION" >&2
exit 1
fi
@@ -61,7 +62,7 @@ is_integer() {
printf %d "$1" >/dev/null 2>&1
}
-token="$(sed -n "${dec_address}p" "$debug_file")"
+token="$(sed -n "${dec_address}p" "$debug_file" | cut -d' ' -f1)"
: "${token:?cannot find integer from debug file at given byte}"
is_integer "$token" || {
printf "can't find an integer token number in %s for byte %X\n" "$debug_file" "$address" >&2