aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorpgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-11-28 21:06:00 +0000
committerpgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-11-28 21:06:00 +0000
commit5a0ac7b22e20115c5227a59e2262aa7085688e33 (patch)
treee0d404c3b121062ca58a92aba8111c4863082f14 /util-linux
parentf77741b8e3dae00454b28ae22cdb3833acfe9e41 (diff)
downloadbusybox-w32-5a0ac7b22e20115c5227a59e2262aa7085688e33.tar.gz
busybox-w32-5a0ac7b22e20115c5227a59e2262aa7085688e33.tar.bz2
busybox-w32-5a0ac7b22e20115c5227a59e2262aa7085688e33.zip
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.) git-svn-id: svn://busybox.net/trunk/busybox@12560 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 1858b08d4..e2cbcaf89 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -57,7 +57,7 @@ static const char * const add_strings[] = {
57 57
58static const char add_first[] = "\"%07.7_Ax\n\""; 58static const char add_first[] = "\"%07.7_Ax\n\"";
59 59
60static const char hexdump_opts[] = "bcdoxe:f:n:s:v"; 60static const char hexdump_opts[] = "bcdoxCe:f:n:s:v";
61 61
62static const struct suffix_mult suffixes[] = { 62static const struct suffix_mult suffixes[] = {
63 {"b", 512 }, 63 {"b", 512 },
@@ -80,6 +80,10 @@ int hexdump_main(int argc, char **argv)
80 if ((p - hexdump_opts) < 5) { 80 if ((p - hexdump_opts) < 5) {
81 bb_dump_add(add_first); 81 bb_dump_add(add_first);
82 bb_dump_add(add_strings[(int)(p - hexdump_opts)]); 82 bb_dump_add(add_strings[(int)(p - hexdump_opts)]);
83 } else if (ch == 'C') {
84 bb_dump_add("\"%08.8_Ax\n\"");
85 bb_dump_add("\"%08.8_ax \" 8/1 \"%02x \" \" \" 8/1 \"%02x \" ");
86 bb_dump_add("\" |\" 16/1 \"%_p\" \"|\\n\"");
83 } else { 87 } else {
84 /* Sae a little bit of space below by omitting the 'else's. */ 88 /* Sae a little bit of space below by omitting the 'else's. */
85 if (ch == 'e') { 89 if (ch == 'e') {