fireyfly / hexd Goto Github PK
View Code? Open in Web Editor NEW๐ Colourful, human-friendly hexdump tool
License: MIT License
๐ Colourful, human-friendly hexdump tool
License: MIT License
There is some kind of interplay between -w
and the chunk size that causes hexd to print misaligned lines in some cases.
E.g. hexd -w 28 -g 4 $(which hexd)
shows this misalignment around BUFSIZ
-sized chunks:
...
03b8 63 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 01 00 00 c... .... .... .... .... .... E...
03d4 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a8 00 00 00 12 00 00 00 ... .... .... .... .... ยจ... ....
03f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .... .... .... ....
0400 cc 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 89 00 00 00 ร... .... .... .... .... .... โฐ...
041c 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e4 00 00 00 12 00 00 00 .... .... .... .... .... รค... ....
...
This appears to "only" be cosmetic, in that it doesn't look like the data being printed is corrupted (at least from first glance); no data seems to be missing/duplicated. A similar issue also affects pixd (with -w 28
).
The issue appears to be that BUFSIZ
-sized chunks are handled at a time, and each row only contains printed bytes from the same chunk. Thus, if the line width isn't a multiple of the chunk size, the last line within that chunk will be incomplete (in this case only displaying 16 bytes).
Reported by @zgrep.
Sometimes it's useful to see every byte of a file, and disable autoskip for that.
Currently, hexd unconditionally defaults to colourised output, and has the -p
flag for turning colour off. A better option would be to default to detecting colour based on tty-ness (a la GNU --color=auto
) and have explicit flags for turning colour on or off.
--color[=WHEN]
. GNU ls
defaults to no colours, but I think defaulting to colours if output is a tty is okay.alias hexd=hexd -p
or similar.Same as FireyFly/pixd#3, it'd be great if Makefile had an 'install' option to install the binary, and the man page.
Old hexd had this feature: default to automatically determining a width based on tty width (i.e. $COLUMNS
, tput cols
). It would look at the -g
option and use the maximum number of groups per line that would fit. The upside is better terminal size utilization, but the downside is that a width of e.g. 0x18 might be less convenient than 0x10 (the usual default) because it offsets every other line, kinda.
I'm not sure I really liked this feature, but as I'm undecided I'm opening this issue to not forget to ponder it in the future. It could always be added as an optional thing controlled by an environment variable, but OTOH adding unwanted features seems like a recipe for feature creep/just general untidyness..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.