diff options
Diffstat (limited to 'coreutils/od_bloaty.c')
-rw-r--r-- | coreutils/od_bloaty.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index a083114c9..4526f0ede 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -188,7 +188,7 @@ static off_t pseudo_offset; | |||
188 | a multiple of the least common multiple of the sizes associated with | 188 | a multiple of the least common multiple of the sizes associated with |
189 | the specified output types. It should be as large as possible, but | 189 | the specified output types. It should be as large as possible, but |
190 | no larger than 16 -- unless specified with the -w option. */ | 190 | no larger than 16 -- unless specified with the -w option. */ |
191 | static size_t bytes_per_block; | 191 | static unsigned bytes_per_block = 32; /* have to use unsigned, not size_t */ |
192 | 192 | ||
193 | /* A NULL-terminated list of the file-arguments from the command line. */ | 193 | /* A NULL-terminated list of the file-arguments from the command line. */ |
194 | static const char *const *file_list; | 194 | static const char *const *file_list; |
@@ -1218,7 +1218,6 @@ int od_main(int argc, char **argv) | |||
1218 | ; | 1218 | ; |
1219 | #endif | 1219 | #endif |
1220 | char *str_A, *str_N, *str_j, *str_S; | 1220 | char *str_A, *str_N, *str_j, *str_S; |
1221 | char *str_w = NULL; | ||
1222 | llist_t *lst_t = NULL; | 1221 | llist_t *lst_t = NULL; |
1223 | unsigned opt; | 1222 | unsigned opt; |
1224 | int l_c_m; | 1223 | int l_c_m; |
@@ -1239,7 +1238,7 @@ int od_main(int argc, char **argv) | |||
1239 | /* flag_dump_strings = 0; - already is */ | 1238 | /* flag_dump_strings = 0; - already is */ |
1240 | 1239 | ||
1241 | /* Parse command line */ | 1240 | /* Parse command line */ |
1242 | opt_complementary = "t::"; // list | 1241 | opt_complementary = "w+:t::"; /* -w N, -t is a list */ |
1243 | #if ENABLE_GETOPT_LONG | 1242 | #if ENABLE_GETOPT_LONG |
1244 | applet_long_options = od_longopts; | 1243 | applet_long_options = od_longopts; |
1245 | #endif | 1244 | #endif |
@@ -1248,7 +1247,7 @@ int od_main(int argc, char **argv) | |||
1248 | // -S was -s and also had optional parameter | 1247 | // -S was -s and also had optional parameter |
1249 | // but in coreutils 6.3 it was renamed and now has | 1248 | // but in coreutils 6.3 it was renamed and now has |
1250 | // _mandatory_ parameter | 1249 | // _mandatory_ parameter |
1251 | &str_A, &str_N, &str_j, &lst_t, &str_S, &str_w); | 1250 | &str_A, &str_N, &str_j, &lst_t, &str_S, &bytes_per_block); |
1252 | argc -= optind; | 1251 | argc -= optind; |
1253 | argv += optind; | 1252 | argv += optind; |
1254 | if (opt & OPT_A) { | 1253 | if (opt & OPT_A) { |
@@ -1404,9 +1403,6 @@ int od_main(int argc, char **argv) | |||
1404 | l_c_m = get_lcm(); | 1403 | l_c_m = get_lcm(); |
1405 | 1404 | ||
1406 | if (opt & OPT_w) { /* -w: width */ | 1405 | if (opt & OPT_w) { /* -w: width */ |
1407 | bytes_per_block = 32; | ||
1408 | if (str_w) | ||
1409 | bytes_per_block = xatou(str_w); | ||
1410 | if (!bytes_per_block || bytes_per_block % l_c_m != 0) { | 1406 | if (!bytes_per_block || bytes_per_block % l_c_m != 0) { |
1411 | bb_error_msg("warning: invalid width %u; using %d instead", | 1407 | bb_error_msg("warning: invalid width %u; using %d instead", |
1412 | (unsigned)bytes_per_block, l_c_m); | 1408 | (unsigned)bytes_per_block, l_c_m); |