aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-05-26 12:56:17 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-05-26 12:56:17 +0200
commit60d4d55b870757089cdae96920cf6c416ba2de37 (patch)
treeca1883766cb079e79b41a537580fa3d171cda65a /coreutils
parent3c6f6382eef14b880550cbf28ac5a517d0a075fc (diff)
downloadbusybox-w32-60d4d55b870757089cdae96920cf6c416ba2de37.tar.gz
busybox-w32-60d4d55b870757089cdae96920cf6c416ba2de37.tar.bz2
busybox-w32-60d4d55b870757089cdae96920cf6c416ba2de37.zip
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')
-rw-r--r--coreutils/od.c4
-rw-r--r--coreutils/od_bloaty.c43
2 files changed, 30 insertions, 17 deletions
diff --git a/coreutils/od.c b/coreutils/od.c
index 46aba5a7c..98ae06ba7 100644
--- a/coreutils/od.c
+++ b/coreutils/od.c
@@ -22,7 +22,9 @@
22 22
23//usage:#if !ENABLE_DESKTOP 23//usage:#if !ENABLE_DESKTOP
24//usage:#define od_trivial_usage 24//usage:#define od_trivial_usage
25//usage: "[-aBbcDdeFfHhIiLlOoXxsv] [FILE]" 25//usage: "[-abcdeFfhIiLloxsv] [FILE]"
26// We also support -BDOHXIL, but they are not documented in coreutils 9.1
27// manpage/help, so don't show them either.
26//usage:#define od_full_usage "\n\n" 28//usage:#define od_full_usage "\n\n"
27//usage: "Print FILE (or stdin) unambiguously, as octal bytes by default" 29//usage: "Print FILE (or stdin) unambiguously, as octal bytes by default"
28//usage:#endif 30//usage:#endif
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 57a4fe163..2782adbf6 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -27,6 +27,8 @@
27//usage:#if ENABLE_DESKTOP 27//usage:#if ENABLE_DESKTOP
28//usage:#define od_trivial_usage 28//usage:#define od_trivial_usage
29//usage: "[-abcdfhilovxs] [-t TYPE] [-A RADIX] [-N SIZE] [-j SKIP] [-S MINSTR] [-w WIDTH] [FILE]..." 29//usage: "[-abcdfhilovxs] [-t TYPE] [-A RADIX] [-N SIZE] [-j SKIP] [-S MINSTR] [-w WIDTH] [FILE]..."
30// We also support -BDOHXIL, but they are not documented in coreutils 9.1
31// manpage/help, so don't show them either.
30// We don't support: 32// We don't support:
31// ... [FILE] [[+]OFFSET[.][b]] 33// ... [FILE] [[+]OFFSET[.][b]]
32// Support is buggy for: 34// Support is buggy for:
@@ -43,27 +45,33 @@ enum {
43 OPT_b = 1 << 3, 45 OPT_b = 1 << 3,
44 OPT_c = 1 << 4, 46 OPT_c = 1 << 4,
45 OPT_d = 1 << 5, 47 OPT_d = 1 << 5,
46 OPT_f = 1 << 6, 48 OPT_D = 1 << 6, /* undocumented in coreutils 9.1 */
47 OPT_h = 1 << 7, 49 OPT_f = 1 << 7,
48 OPT_i = 1 << 8, 50 OPT_h = 1 << 8,
49 OPT_j = 1 << 9, 51 OPT_H = 1 << 9, /* undocumented in coreutils 9.1 */
50 OPT_l = 1 << 10, 52 OPT_i = 1 << 10,
51 OPT_o = 1 << 11, 53 OPT_I = 1 << 11, /* undocumented in coreutils 9.1 */
52 OPT_B = 1 << 12, /* undocumented synonym to -o */ 54 OPT_j = 1 << 12,
53 OPT_t = 1 << 13, 55 OPT_l = 1 << 13,
56 OPT_L = 1 << 14, /* undocumented in coreutils 9.1 */
57 OPT_o = 1 << 15,
58 OPT_O = 1 << 16, /* undocumented in coreutils 9.1 */
59 OPT_B = 1 << 17, /* undocumented synonym to -o */
60 OPT_t = 1 << 18,
54 /* When zero and two or more consecutive blocks are equal, format 61 /* When zero and two or more consecutive blocks are equal, format
55 only the first block and output an asterisk alone on the following 62 only the first block and output an asterisk alone on the following
56 line to indicate that identical blocks have been elided: */ 63 line to indicate that identical blocks have been elided: */
57 OPT_v = 1 << 14, 64 OPT_v = 1 << 19,
58 OPT_x = 1 << 15, 65 OPT_x = 1 << 20,
59 OPT_s = 1 << 16, 66 OPT_X = 1 << 21, /* undocumented in coreutils 9.1 */
60 OPT_S = 1 << 17, 67 OPT_s = 1 << 22,
61 OPT_w = 1 << 18, 68 OPT_S = 1 << 23,
62 OPT_traditional = (1 << 19) * ENABLE_LONG_OPTS, 69 OPT_w = 1 << 24,
70 OPT_traditional = (1 << 25) * ENABLE_LONG_OPTS,
63}; 71};
64 72
65#define OD_GETOPT32() getopt32long(argv, \ 73#define OD_GETOPT32() getopt32long(argv, \
66 "A:N:abcdfhij:loBt:*vxsS:w:+:", od_longopts, \ 74 "A:N:abcdDfhHiIj:lLoOBt:*vxXsS:w:+:", od_longopts, \
67 /* -w with optional param */ \ 75 /* -w with optional param */ \
68 /* -S was -s and also had optional parameter */ \ 76 /* -S was -s and also had optional parameter */ \
69 /* but in coreutils 6.3 it was renamed and now has */ \ 77 /* but in coreutils 6.3 it was renamed and now has */ \
@@ -1245,14 +1253,17 @@ int od_main(int argc UNUSED_PARAM, char **argv)
1245 if (opt & OPT_b) decode_format_string("oC"); 1253 if (opt & OPT_b) decode_format_string("oC");
1246 if (opt & OPT_c) decode_format_string("c"); 1254 if (opt & OPT_c) decode_format_string("c");
1247 if (opt & OPT_d) decode_format_string("u2"); 1255 if (opt & OPT_d) decode_format_string("u2");
1256 if (opt & OPT_D) decode_format_string("uI");
1248 if (opt & OPT_f) decode_format_string("fF"); 1257 if (opt & OPT_f) decode_format_string("fF");
1249 if (opt & (OPT_h|OPT_x)) decode_format_string("x2"); 1258 if (opt & (OPT_h|OPT_x)) decode_format_string("x2");
1259 if (opt & (OPT_H|OPT_X)) decode_format_string("xI");
1250 if (opt & OPT_i) decode_format_string("dI"); 1260 if (opt & OPT_i) decode_format_string("dI");
1251 if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm_suffixes); 1261 if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm_suffixes);
1252 /* This probably also depends on word width of the arch (what is "long"?) */ 1262 /* This probably also depends on word width of the arch (what is "long"?) */
1253 /* should be "d4" or "d8" depending on sizeof(long)? */ 1263 /* should be "d4" or "d8" depending on sizeof(long)? */
1254 if (opt & OPT_l) decode_format_string("d8"); 1264 if (opt & (OPT_I|OPT_l|OPT_L)) decode_format_string("d8");
1255 if (opt & (OPT_o|OPT_B)) decode_format_string("o2"); 1265 if (opt & (OPT_o|OPT_B)) decode_format_string("o2");
1266 if (opt & OPT_O) decode_format_string("oI");
1256 while (lst_t) { 1267 while (lst_t) {
1257 decode_format_string(llist_pop(&lst_t)); 1268 decode_format_string(llist_pop(&lst_t));
1258 } 1269 }