diff options
Diffstat (limited to 'util-linux/hexdump.c')
-rw-r--r-- | util-linux/hexdump.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index 4a7f641db..4b536e1c2 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c | |||
@@ -47,6 +47,7 @@ | |||
47 | //usage: "\n -d Two-byte decimal display" | 47 | //usage: "\n -d Two-byte decimal display" |
48 | //usage: "\n -e FORMAT_STRING" | 48 | //usage: "\n -e FORMAT_STRING" |
49 | //usage: "\n -f FORMAT_FILE" | 49 | //usage: "\n -f FORMAT_FILE" |
50 | // exactly the same help text lines in hexdump and xxd: | ||
50 | //usage: "\n -n LENGTH Interpret only LENGTH bytes of input" | 51 | //usage: "\n -n LENGTH Interpret only LENGTH bytes of input" |
51 | //usage: "\n -o Two-byte octal display" | 52 | //usage: "\n -o Two-byte octal display" |
52 | //usage: "\n -s OFFSET Skip OFFSET bytes" | 53 | //usage: "\n -s OFFSET Skip OFFSET bytes" |
@@ -83,11 +84,11 @@ static void bb_dump_addfile(dumper_t *dumper, char *name) | |||
83 | } | 84 | } |
84 | 85 | ||
85 | static const char *const add_strings[] = { | 86 | static const char *const add_strings[] = { |
86 | "\"%07.7_ax \" 16/1 \"%03o \" \"\\n\"", /* b */ | 87 | "\"%07.7_ax \"16/1 \"%03o \"\"\n\"", /* b */ |
87 | "\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"", /* c */ | 88 | "\"%07.7_ax \"16/1 \"%3_c \"\"\n\"", /* c */ |
88 | "\"%07.7_ax \" 8/2 \" %05u \" \"\\n\"", /* d */ | 89 | "\"%07.7_ax \"8/2 \" %05u \"\"\n\"", /* d */ |
89 | "\"%07.7_ax \" 8/2 \" %06o \" \"\\n\"", /* o */ | 90 | "\"%07.7_ax \"8/2 \" %06o \"\"\n\"", /* o */ |
90 | "\"%07.7_ax \" 8/2 \" %04x \" \"\\n\"", /* x */ | 91 | "\"%07.7_ax \"8/2 \" %04x \"\"\n\"", /* x */ |
91 | }; | 92 | }; |
92 | 93 | ||
93 | static const char add_first[] ALIGN1 = "\"%07.7_Ax\n\""; | 94 | static const char add_first[] ALIGN1 = "\"%07.7_Ax\n\""; |
@@ -125,9 +126,11 @@ int hexdump_main(int argc, char **argv) | |||
125 | /* Save a little bit of space below by omitting the 'else's. */ | 126 | /* Save a little bit of space below by omitting the 'else's. */ |
126 | if (ch == 'C') { | 127 | if (ch == 'C') { |
127 | hd_applet: | 128 | hd_applet: |
128 | bb_dump_add(dumper, "\"%08.8_Ax\n\""); | 129 | bb_dump_add(dumper, "\"%08.8_Ax\n\""); // final address line after dump |
129 | bb_dump_add(dumper, "\"%08.8_ax \" 8/1 \"%02x \" \" \" 8/1 \"%02x \" "); | 130 | //------------------- "address " 8 * "xx " " " 8 * "xx " |
130 | bb_dump_add(dumper, "\" |\" 16/1 \"%_p\" \"|\\n\""); | 131 | bb_dump_add(dumper, "\"%08.8_ax \"8/1 \"%02x \" \" \"8/1 \"%02x \""); |
132 | //------------------- " |ASCII...........|\n" | ||
133 | bb_dump_add(dumper, "\" |\"16/1 \"%_p\"\"|\n\""); | ||
131 | } | 134 | } |
132 | if (ch == 'e') { | 135 | if (ch == 'e') { |
133 | bb_dump_add(dumper, optarg); | 136 | bb_dump_add(dumper, optarg); |
@@ -158,7 +161,7 @@ int hexdump_main(int argc, char **argv) | |||
158 | 161 | ||
159 | if (!dumper->fshead) { | 162 | if (!dumper->fshead) { |
160 | bb_dump_add(dumper, add_first); | 163 | bb_dump_add(dumper, add_first); |
161 | bb_dump_add(dumper, "\"%07.7_ax \" 8/2 \"%04x \" \"\\n\""); | 164 | bb_dump_add(dumper, "\"%07.7_ax \"8/2 \"%04x \"\"\n\""); |
162 | } | 165 | } |
163 | 166 | ||
164 | argv += optind; | 167 | argv += optind; |