aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-05-25 22:17:18 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-05-25 22:17:18 +0200
commit6882a933cf078be35f4eb93963365549d43cb497 (patch)
tree3da4d853f061cd53fdaeb89dc43ecf258150e6fe /coreutils
parentce4cfc33cade63513963f9d5e701f305cbdfe693 (diff)
downloadbusybox-w32-6882a933cf078be35f4eb93963365549d43cb497.tar.gz
busybox-w32-6882a933cf078be35f4eb93963365549d43cb497.tar.bz2
busybox-w32-6882a933cf078be35f4eb93963365549d43cb497.zip
od: implement -B
function old new delta .rodata 105305 105306 +1 od_main 1880 1866 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 1/-14) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/od_bloaty.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 51fff436b..57a4fe163 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -49,20 +49,21 @@ enum {
49 OPT_j = 1 << 9, 49 OPT_j = 1 << 9,
50 OPT_l = 1 << 10, 50 OPT_l = 1 << 10,
51 OPT_o = 1 << 11, 51 OPT_o = 1 << 11,
52 OPT_t = 1 << 12, 52 OPT_B = 1 << 12, /* undocumented synonym to -o */
53 OPT_t = 1 << 13,
53 /* When zero and two or more consecutive blocks are equal, format 54 /* When zero and two or more consecutive blocks are equal, format
54 only the first block and output an asterisk alone on the following 55 only the first block and output an asterisk alone on the following
55 line to indicate that identical blocks have been elided: */ 56 line to indicate that identical blocks have been elided: */
56 OPT_v = 1 << 13, 57 OPT_v = 1 << 14,
57 OPT_x = 1 << 14, 58 OPT_x = 1 << 15,
58 OPT_s = 1 << 15, 59 OPT_s = 1 << 16,
59 OPT_S = 1 << 16, 60 OPT_S = 1 << 17,
60 OPT_w = 1 << 17, 61 OPT_w = 1 << 18,
61 OPT_traditional = (1 << 18) * ENABLE_LONG_OPTS, 62 OPT_traditional = (1 << 19) * ENABLE_LONG_OPTS,
62}; 63};
63 64
64#define OD_GETOPT32() getopt32long(argv, \ 65#define OD_GETOPT32() getopt32long(argv, \
65 "A:N:abcdfhij:lot:*vxsS:w:+:", od_longopts, \ 66 "A:N:abcdfhij:loBt:*vxsS:w:+:", od_longopts, \
66 /* -w with optional param */ \ 67 /* -w with optional param */ \
67 /* -S was -s and also had optional parameter */ \ 68 /* -S was -s and also had optional parameter */ \
68 /* but in coreutils 6.3 it was renamed and now has */ \ 69 /* but in coreutils 6.3 it was renamed and now has */ \
@@ -1239,22 +1240,22 @@ int od_main(int argc UNUSED_PARAM, char **argv)
1239 if (opt & OPT_N) { 1240 if (opt & OPT_N) {
1240 max_bytes_to_format = xstrtooff_sfx(str_N, 0, bkm_suffixes); 1241 max_bytes_to_format = xstrtooff_sfx(str_N, 0, bkm_suffixes);
1241 } 1242 }
1243
1242 if (opt & OPT_a) decode_format_string("a"); 1244 if (opt & OPT_a) decode_format_string("a");
1243 if (opt & OPT_b) decode_format_string("oC"); 1245 if (opt & OPT_b) decode_format_string("oC");
1244 if (opt & OPT_c) decode_format_string("c"); 1246 if (opt & OPT_c) decode_format_string("c");
1245 if (opt & OPT_d) decode_format_string("u2"); 1247 if (opt & OPT_d) decode_format_string("u2");
1246 if (opt & OPT_f) decode_format_string("fF"); 1248 if (opt & OPT_f) decode_format_string("fF");
1247 if (opt & OPT_h) decode_format_string("x2"); 1249 if (opt & (OPT_h|OPT_x)) decode_format_string("x2");
1248 if (opt & OPT_i) decode_format_string("dI"); 1250 if (opt & OPT_i) decode_format_string("dI");
1249 if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm_suffixes); 1251 if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm_suffixes);
1250 /* This probably also depends on word width of the arch (what is "long"?) */ 1252 /* This probably also depends on word width of the arch (what is "long"?) */
1251 /* should be "d4" or "d8" depending on sizeof(long)? */ 1253 /* should be "d4" or "d8" depending on sizeof(long)? */
1252 if (opt & OPT_l) decode_format_string("d8"); 1254 if (opt & OPT_l) decode_format_string("d8");
1253 if (opt & OPT_o) decode_format_string("o2"); 1255 if (opt & (OPT_o|OPT_B)) decode_format_string("o2");
1254 while (lst_t) { 1256 while (lst_t) {
1255 decode_format_string(llist_pop(&lst_t)); 1257 decode_format_string(llist_pop(&lst_t));
1256 } 1258 }
1257 if (opt & OPT_x) decode_format_string("x2");
1258 if (opt & OPT_s) decode_format_string("d2"); 1259 if (opt & OPT_s) decode_format_string("d2");
1259 if (opt & OPT_S) { 1260 if (opt & OPT_S) {
1260 G.string_min = xstrtou_sfx(str_S, 0, bkm_suffixes); 1261 G.string_min = xstrtou_sfx(str_S, 0, bkm_suffixes);