> On Sat, Apr 20, 2024 at 7:38 PM Oliver Webb via Toybox > [email protected] wrote:
> > xxd also runs on average about 5 times slower than vim xxd, this is > > because of read reading 16 bytes at a time, also not hard to fix, but > > very hard to fix cleanly. > > > really? a quick glance suggests it reads blocks of sizeof(toybuf)? (or > "whatever stdio is using for its buffer" in the -r case.) strace-ing it shows: read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 16 And if you pass in -c 12 to it: read(0, "\0\0\0\0\0\0\0\0\0\0\0\0", 12) = 12 In practice, it's always what -c is > > xxd has a -d flag to do decimal address lables that I added in this patch. > > do you have a use for that? i saw it and ignored it when > implementing toybox xxd because i couldn't even imagine a use for > decimal addresses... Trying to do math with them in awk or expr or some other program where numbers are always read as base 10: $ head -c 0xf head: invalid number of bytes: ‘0xf’ I think the ability to read base 16 numbers and prefixes in toybox is a really cool consequence of everything being in one binary. But almost every other utility set doesn't have it because most aren't multi-call binaries. - Oliver Webb [email protected] _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
