summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorPaul Fox2005-11-28 21:06:00 +0000
committerPaul Fox2005-11-28 21:06:00 +0000
commit969af897970b493f2615a233f7c83ca86a6d488f (patch)
treee0d404c3b121062ca58a92aba8111c4863082f14 /util-linux
parentd957b9537ee2b93af93c92dbb8a2a6cfc3682318 (diff)
downloadbusybox-969af897970b493f2615a233f7c83ca86a6d488f.zip
busybox-969af897970b493f2615a233f7c83ca86a6d488f.tar.gz
add "-C" format to hexdump
fixes bug #113 and satisfies a personal need at the same time. output compares identically to util-linux version. (with exception of whitespace differences on last lines of output with non-uniform length, which are neither fixed nor worsened by this change.)
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/hexdump.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index 1858b08..e2cbcaf 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -57,7 +57,7 @@ static const char * const add_strings[] = {
static const char add_first[] = "\"%07.7_Ax\n\"";
-static const char hexdump_opts[] = "bcdoxe:f:n:s:v";
+static const char hexdump_opts[] = "bcdoxCe:f:n:s:v";
static const struct suffix_mult suffixes[] = {
{"b", 512 },
@@ -80,6 +80,10 @@ int hexdump_main(int argc, char **argv)
if ((p - hexdump_opts) < 5) {
bb_dump_add(add_first);
bb_dump_add(add_strings[(int)(p - hexdump_opts)]);
+ } else if (ch == 'C') {
+ bb_dump_add("\"%08.8_Ax\n\"");
+ bb_dump_add("\"%08.8_ax \" 8/1 \"%02x \" \" \" 8/1 \"%02x \" ");
+ bb_dump_add("\" |\" 16/1 \"%_p\" \"|\\n\"");
} else {
/* Sae a little bit of space below by omitting the 'else's. */
if (ch == 'e') {