summaryrefslogtreecommitdiff
path: root/coreutils/od_bloaty.c
diff options
context:
space:
mode:
authorDenys Vlasenko2023-05-26 12:56:17 +0200
committerDenys Vlasenko2023-05-26 12:56:17 +0200
commit60d4d55b870757089cdae96920cf6c416ba2de37 (patch)
treeca1883766cb079e79b41a537580fa3d171cda65a /coreutils/od_bloaty.c
parent3c6f6382eef14b880550cbf28ac5a517d0a075fc (diff)
downloadbusybox-60d4d55b870757089cdae96920cf6c416ba2de37.zip
busybox-60d4d55b870757089cdae96920cf6c416ba2de37.tar.gz
od: support -DOHXIL
function old new delta od_main 1866 1917 +51 .rodata 105306 105321 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 66/0) Total: 66 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/od_bloaty.c')
-rw-r--r--coreutils/od_bloaty.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 57a4fe1..2782adb 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -27,6 +27,8 @@
//usage:#if ENABLE_DESKTOP
//usage:#define od_trivial_usage
//usage: "[-abcdfhilovxs] [-t TYPE] [-A RADIX] [-N SIZE] [-j SKIP] [-S MINSTR] [-w WIDTH] [FILE]..."
+// We also support -BDOHXIL, but they are not documented in coreutils 9.1
+// manpage/help, so don't show them either.
// We don't support:
// ... [FILE] [[+]OFFSET[.][b]]
// Support is buggy for:
@@ -43,27 +45,33 @@ enum {
OPT_b = 1 << 3,
OPT_c = 1 << 4,
OPT_d = 1 << 5,
- OPT_f = 1 << 6,
- OPT_h = 1 << 7,
- OPT_i = 1 << 8,
- OPT_j = 1 << 9,
- OPT_l = 1 << 10,
- OPT_o = 1 << 11,
- OPT_B = 1 << 12, /* undocumented synonym to -o */
- OPT_t = 1 << 13,
+ OPT_D = 1 << 6, /* undocumented in coreutils 9.1 */
+ OPT_f = 1 << 7,
+ OPT_h = 1 << 8,
+ OPT_H = 1 << 9, /* undocumented in coreutils 9.1 */
+ OPT_i = 1 << 10,
+ OPT_I = 1 << 11, /* undocumented in coreutils 9.1 */
+ OPT_j = 1 << 12,
+ OPT_l = 1 << 13,
+ OPT_L = 1 << 14, /* undocumented in coreutils 9.1 */
+ OPT_o = 1 << 15,
+ OPT_O = 1 << 16, /* undocumented in coreutils 9.1 */
+ OPT_B = 1 << 17, /* undocumented synonym to -o */
+ OPT_t = 1 << 18,
/* When zero and two or more consecutive blocks are equal, format
only the first block and output an asterisk alone on the following
line to indicate that identical blocks have been elided: */
- OPT_v = 1 << 14,
- OPT_x = 1 << 15,
- OPT_s = 1 << 16,
- OPT_S = 1 << 17,
- OPT_w = 1 << 18,
- OPT_traditional = (1 << 19) * ENABLE_LONG_OPTS,
+ OPT_v = 1 << 19,
+ OPT_x = 1 << 20,
+ OPT_X = 1 << 21, /* undocumented in coreutils 9.1 */
+ OPT_s = 1 << 22,
+ OPT_S = 1 << 23,
+ OPT_w = 1 << 24,
+ OPT_traditional = (1 << 25) * ENABLE_LONG_OPTS,
};
#define OD_GETOPT32() getopt32long(argv, \
- "A:N:abcdfhij:loBt:*vxsS:w:+:", od_longopts, \
+ "A:N:abcdDfhHiIj:lLoOBt:*vxXsS:w:+:", od_longopts, \
/* -w with optional param */ \
/* -S was -s and also had optional parameter */ \
/* but in coreutils 6.3 it was renamed and now has */ \
@@ -1245,14 +1253,17 @@ int od_main(int argc UNUSED_PARAM, char **argv)
if (opt & OPT_b) decode_format_string("oC");
if (opt & OPT_c) decode_format_string("c");
if (opt & OPT_d) decode_format_string("u2");
+ if (opt & OPT_D) decode_format_string("uI");
if (opt & OPT_f) decode_format_string("fF");
if (opt & (OPT_h|OPT_x)) decode_format_string("x2");
+ if (opt & (OPT_H|OPT_X)) decode_format_string("xI");
if (opt & OPT_i) decode_format_string("dI");
if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm_suffixes);
/* This probably also depends on word width of the arch (what is "long"?) */
/* should be "d4" or "d8" depending on sizeof(long)? */
- if (opt & OPT_l) decode_format_string("d8");
+ if (opt & (OPT_I|OPT_l|OPT_L)) decode_format_string("d8");
if (opt & (OPT_o|OPT_B)) decode_format_string("o2");
+ if (opt & OPT_O) decode_format_string("oI");
while (lst_t) {
decode_format_string(llist_pop(&lst_t));
}