From b60268d835de9fcb06003902f86228862e77e3e7 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 2 Jul 2021 14:12:54 +0200 Subject: [dev] Add support for xxd without -e --- modules/dev.inc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules') diff --git a/modules/dev.inc b/modules/dev.inc index 6d66678..fcde631 100644 --- a/modules/dev.inc +++ b/modules/dev.inc @@ -236,6 +236,8 @@ __init() { hexdump -ve '/4 "%02x"' | sed 's/\(........\)\(........\)/\2\1/' fi } + elif [ "$( printf z2345678 | xxd -g 8 | cut -d' ' -f2 | awk '{ for (i=length-1;i>0;i-=2)x=x substr($0,i,2);}END{print x}' )" = "$t" ]; then + __bin2hex_le() { xxd -g "$1" | cut -d' ' -f2 | awk '{ for (i=length-1;i>0;i-=2)x=x substr($0,i,2);}END{print x}'; } else echo "No suitable tool for converting binary data to little endian hex" >&2 exit 1 -- cgit v1.2.3-55-g7522