diff options
author | Denys Vlasenko | 2023-05-25 23:48:13 +0200 |
---|---|---|
committer | Denys Vlasenko | 2023-05-25 23:48:13 +0200 |
commit | 0c3270f7e55e0ca7b8d664851468511d2c8995cf (patch) | |
tree | fdaf00c6f2db56cab992eec0d556b3ef0db61381 /coreutils | |
parent | 6882a933cf078be35f4eb93963365549d43cb497 (diff) | |
download | busybox-0c3270f7e55e0ca7b8d664851468511d2c8995cf.zip busybox-0c3270f7e55e0ca7b8d664851468511d2c8995cf.tar.gz |
od: stop printing extra trailing spaces
function old new delta
.rodata 104598 104613 +15
display 1475 1485 +10
od_main 549 556 +7
rewrite 971 967 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 32/-4) Total: 28 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/od.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/coreutils/od.c b/coreutils/od.c index bd82487..abedb40 100644 --- a/coreutils/od.c +++ b/coreutils/od.c @@ -157,22 +157,22 @@ odoffset(dumper_t *dumper, int argc, char ***argvp) // The format is required and must be surrounded by " "s. // It is a printf-style format. static const char *const add_strings[] ALIGN_PTR = { - "16/1 \"%3_u \" \"\\n\"", /* 0: a */ - "8/2 \"%06o \" \"\\n\"", /* 1: B (undocumented in od), o */ - "16/1 \"%03o \" \"\\n\"", /* 2: b */ - "16/1 \"%3_c \" \"\\n\"", /* 3: c */ - "8/2 \"%5u \" \"\\n\"", /* 4: d */ - "4/4 \"%10u \" \"\\n\"", /* 5: D */ - "2/8 \"%24.14e \" \"\\n\"", /* 6: e (undocumented in od), F */ - "4/4 \"%15.7e \" \"\\n\"", /* 7: f */ - "4/4 \"%08x \" \"\\n\"", /* 8: H, X */ - "8/2 \"%04x \" \"\\n\"", /* 9: h, x */ + "16/1 \" %3_u\" \"\\n\"", /* 0: a */ + "8/2 \" %06o\" \"\\n\"", /* 1: B (undocumented in od), o */ + "16/1 \" %03o\" \"\\n\"", /* 2: b */ + "16/1 \" %3_c\" \"\\n\"", /* 3: c */ + "8/2 \" %5u\" \"\\n\"", /* 4: d */ + "4/4 \" %10u\" \"\\n\"", /* 5: D */ + "2/8 \" %24.14e\" \"\\n\"", /* 6: e (undocumented in od), F */ + "4/4 \" %15.7e\" \"\\n\"", /* 7: f */ + "4/4 \" %08x\" \"\\n\"", /* 8: H, X */ + "8/2 \" %04x\" \"\\n\"", /* 9: h, x */ /* This probably also depends on word width of the arch (what is "long"?) */ /* should be "2/8" or "4/4" depending on sizeof(long)? */ - "2/8 \"%20lld \" \"\\n\"", /* 10: I, L, l */ - "4/4 \"%11d \" \"\\n\"", /* 11: i */ - "4/4 \"%011o \" \"\\n\"", /* 12: O */ - "8/2 \"%6d \" \"\\n\"", /* 13: s */ + "2/8 \" %20lld\" \"\\n\"", /* 10: I, L, l */ + "4/4 \" %11d\" \"\\n\"", /* 11: i */ + "4/4 \" %011o\" \"\\n\"", /* 12: O */ + "8/2 \" %6d\" \"\\n\"", /* 13: s */ }; static const char od_opts[] ALIGN1 = "aBbcDdeFfHhIiLlOoXxsv"; @@ -199,9 +199,9 @@ int od_main(int argc, char **argv) if (first) { first = 0; bb_dump_add(dumper, "\"%07.7_Ao\n\""); - bb_dump_add(dumper, "\"%07.7_ao \""); + bb_dump_add(dumper, "\"%07.7_ao\""); } else { - bb_dump_add(dumper, "\" \""); + bb_dump_add(dumper, "\" \""); } bb_dump_add(dumper, add_strings[(int)od_o2si[(p - od_opts)]]); } else { /* P, p, s, w, or other unhandled */ @@ -212,6 +212,7 @@ int od_main(int argc, char **argv) bb_dump_add(dumper, "\"%07.7_Ao\n\""); bb_dump_add(dumper, "\"%07.7_ao \" 8/2 \"%06o \" \"\\n\""); } + dumper->od_eofstring = "\n"; argc -= optind; argv += optind; |