mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
hexdump: Make non-ASCII output easier to read
Enclose the ASCII-interpretation in pipes, show non-ASCII bytes as a dot, and fix the length of the last line. Note that this makes it more similar to the behavior of many other implementations.
This commit is contained in:
parent
866c9cc1a5
commit
a5dda0b0c5
Notes:
sideshowbarker
2024-07-18 01:39:12 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/a5dda0b0c5a Pull-request: https://github.com/SerenityOS/serenity/pull/10735 Reviewed-by: https://github.com/ADKaster
1 changed files with 5 additions and 4 deletions
|
@ -45,15 +45,16 @@ int main(int argc, char** argv)
|
|||
out(" ");
|
||||
}
|
||||
|
||||
out(" ");
|
||||
out(" |");
|
||||
|
||||
for (size_t i = 0; i < 16; ++i) {
|
||||
if (i < line.size() && isprint(line[i]))
|
||||
for (size_t i = 0; i < line.size(); ++i) {
|
||||
if (isprint(line[i]))
|
||||
putchar(line[i]);
|
||||
else
|
||||
putchar(' ');
|
||||
putchar('.');
|
||||
}
|
||||
|
||||
putchar('|');
|
||||
putchar('\n');
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue