diff options
-rw-r--r-- | usr.bin/hexdump/hexdump.1 | 7 | ||||
-rw-r--r-- | usr.bin/hexdump/hexsyntax.c | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/hexdump/hexdump.1 b/usr.bin/hexdump/hexdump.1 index 321151e..563edac 100644 --- a/usr.bin/hexdump/hexdump.1 +++ b/usr.bin/hexdump/hexdump.1 @@ -39,7 +39,7 @@ .Nd ascii, decimal, hexadecimal, octal dump .Sh SYNOPSIS .Nm hexdump -.Op Fl bcdovx +.Op Fl bcCdovx .Op Fl e Ar format_string .Op Fl f Ar format_file .Op Fl n Ar length @@ -64,6 +64,11 @@ in octal, per line. Display the input offset in hexadecimal, followed by sixteen space-separated, three column, space-filled, characters of input data per line. +.It Fl C +.Em Canonical hex+ASCII display. +Display the input offset in hexadecimal, followed by sixteen +space-separated, two column, hexadecimal bytes, followed by the +same sixteen bytes in %_p format enclosed in ``|'' characters. .It Fl d .Em Two-byte decimal display. Display the input offset in hexadecimal, followed by eight diff --git a/usr.bin/hexdump/hexsyntax.c b/usr.bin/hexdump/hexsyntax.c index 68abbe6..829a6303f 100644 --- a/usr.bin/hexdump/hexsyntax.c +++ b/usr.bin/hexdump/hexsyntax.c @@ -56,7 +56,7 @@ newsyntax(argc, argvp) char *p, **argv; argv = *argvp; - while ((ch = getopt(argc, argv, "bcde:f:n:os:vx")) != EOF) + while ((ch = getopt(argc, argv, "bcCde:f:n:os:vx")) != EOF) switch (ch) { case 'b': add("\"%07.7_Ax\n\""); @@ -66,6 +66,11 @@ newsyntax(argc, argvp) add("\"%07.7_Ax\n\""); add("\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\""); break; + case 'C': + add("\"%08.8_Ax\n\""); + add("\"%08.8_ax \" 16/1 \"%02x \" "); + add("\" |\" 16/1 \"%_p\" \"|\\n\""); + break; case 'd': add("\"%07.7_Ax\n\""); add("\"%07.7_ax \" 8/2 \" %05u \" \"\\n\""); |