aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-05-25 23:48:13 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-05-25 23:48:13 +0200
commit0c3270f7e55e0ca7b8d664851468511d2c8995cf (patch)
treefdaf00c6f2db56cab992eec0d556b3ef0db61381 /coreutils
parent6882a933cf078be35f4eb93963365549d43cb497 (diff)
downloadbusybox-w32-0c3270f7e55e0ca7b8d664851468511d2c8995cf.tar.gz
busybox-w32-0c3270f7e55e0ca7b8d664851468511d2c8995cf.tar.bz2
busybox-w32-0c3270f7e55e0ca7b8d664851468511d2c8995cf.zip
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.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/coreutils/od.c b/coreutils/od.c
index bd82487e5..abedb40a7 100644
--- a/coreutils/od.c
+++ b/coreutils/od.c
@@ -157,22 +157,22 @@ odoffset(dumper_t *dumper, int argc, char ***argvp)
157// The format is required and must be surrounded by " "s. 157// The format is required and must be surrounded by " "s.
158// It is a printf-style format. 158// It is a printf-style format.
159static const char *const add_strings[] ALIGN_PTR = { 159static const char *const add_strings[] ALIGN_PTR = {
160 "16/1 \"%3_u \" \"\\n\"", /* 0: a */ 160 "16/1 \" %3_u\" \"\\n\"", /* 0: a */
161 "8/2 \"%06o \" \"\\n\"", /* 1: B (undocumented in od), o */ 161 "8/2 \" %06o\" \"\\n\"", /* 1: B (undocumented in od), o */
162 "16/1 \"%03o \" \"\\n\"", /* 2: b */ 162 "16/1 \" %03o\" \"\\n\"", /* 2: b */
163 "16/1 \"%3_c \" \"\\n\"", /* 3: c */ 163 "16/1 \" %3_c\" \"\\n\"", /* 3: c */
164 "8/2 \"%5u \" \"\\n\"", /* 4: d */ 164 "8/2 \" %5u\" \"\\n\"", /* 4: d */
165 "4/4 \"%10u \" \"\\n\"", /* 5: D */ 165 "4/4 \" %10u\" \"\\n\"", /* 5: D */
166 "2/8 \"%24.14e \" \"\\n\"", /* 6: e (undocumented in od), F */ 166 "2/8 \" %24.14e\" \"\\n\"", /* 6: e (undocumented in od), F */
167 "4/4 \"%15.7e \" \"\\n\"", /* 7: f */ 167 "4/4 \" %15.7e\" \"\\n\"", /* 7: f */
168 "4/4 \"%08x \" \"\\n\"", /* 8: H, X */ 168 "4/4 \" %08x\" \"\\n\"", /* 8: H, X */
169 "8/2 \"%04x \" \"\\n\"", /* 9: h, x */ 169 "8/2 \" %04x\" \"\\n\"", /* 9: h, x */
170 /* This probably also depends on word width of the arch (what is "long"?) */ 170 /* This probably also depends on word width of the arch (what is "long"?) */
171 /* should be "2/8" or "4/4" depending on sizeof(long)? */ 171 /* should be "2/8" or "4/4" depending on sizeof(long)? */
172 "2/8 \"%20lld \" \"\\n\"", /* 10: I, L, l */ 172 "2/8 \" %20lld\" \"\\n\"", /* 10: I, L, l */
173 "4/4 \"%11d \" \"\\n\"", /* 11: i */ 173 "4/4 \" %11d\" \"\\n\"", /* 11: i */
174 "4/4 \"%011o \" \"\\n\"", /* 12: O */ 174 "4/4 \" %011o\" \"\\n\"", /* 12: O */
175 "8/2 \"%6d \" \"\\n\"", /* 13: s */ 175 "8/2 \" %6d\" \"\\n\"", /* 13: s */
176}; 176};
177 177
178static const char od_opts[] ALIGN1 = "aBbcDdeFfHhIiLlOoXxsv"; 178static const char od_opts[] ALIGN1 = "aBbcDdeFfHhIiLlOoXxsv";
@@ -199,9 +199,9 @@ int od_main(int argc, char **argv)
199 if (first) { 199 if (first) {
200 first = 0; 200 first = 0;
201 bb_dump_add(dumper, "\"%07.7_Ao\n\""); 201 bb_dump_add(dumper, "\"%07.7_Ao\n\"");
202 bb_dump_add(dumper, "\"%07.7_ao \""); 202 bb_dump_add(dumper, "\"%07.7_ao\"");
203 } else { 203 } else {
204 bb_dump_add(dumper, "\" \""); 204 bb_dump_add(dumper, "\" \"");
205 } 205 }
206 bb_dump_add(dumper, add_strings[(int)od_o2si[(p - od_opts)]]); 206 bb_dump_add(dumper, add_strings[(int)od_o2si[(p - od_opts)]]);
207 } else { /* P, p, s, w, or other unhandled */ 207 } else { /* P, p, s, w, or other unhandled */
@@ -212,6 +212,7 @@ int od_main(int argc, char **argv)
212 bb_dump_add(dumper, "\"%07.7_Ao\n\""); 212 bb_dump_add(dumper, "\"%07.7_Ao\n\"");
213 bb_dump_add(dumper, "\"%07.7_ao \" 8/2 \"%06o \" \"\\n\""); 213 bb_dump_add(dumper, "\"%07.7_ao \" 8/2 \"%06o \" \"\\n\"");
214 } 214 }
215 dumper->od_eofstring = "\n";
215 216
216 argc -= optind; 217 argc -= optind;
217 argv += optind; 218 argv += optind;