diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-17 09:09:09 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-17 09:09:09 +0000 |
commit | 1d42665b6b0571b9fa5d3b10fbf2dd03382f0ba2 (patch) | |
tree | 7ec8969fc2b07a2b7dc37f96435e5eddf7daf7fd /coreutils/od_bloaty.c | |
parent | 62a90cdd7435f09f4bb8673e8b7b213067f9d5cc (diff) | |
download | busybox-w32-1d42665b6b0571b9fa5d3b10fbf2dd03382f0ba2.tar.gz busybox-w32-1d42665b6b0571b9fa5d3b10fbf2dd03382f0ba2.tar.bz2 busybox-w32-1d42665b6b0571b9fa5d3b10fbf2dd03382f0ba2.zip |
*: shrink: use Vladimir's "o+" specifier instead of xatou(opt_param)
function old new delta
getopt32 1370 1385 +15
sulogin_main 490 494 +4
realpath_main 84 86 +2
sleep_main 76 77 +1
mt_main 256 257 +1
printenv_main 75 74 -1
fdformat_main 546 545 -1
usleep_main 44 42 -2
setlogcons_main 77 75 -2
ed_main 2654 2649 -5
deallocvt_main 69 64 -5
addgroup_main 373 368 -5
mkfs_minix_main 2989 2982 -7
tail_main 1221 1213 -8
sv_main 1254 1241 -13
du_main 348 328 -20
tftp_main 325 302 -23
split_main 581 558 -23
nc_main 1000 977 -23
diff_main 891 868 -23
arping_main 1797 1770 -27
ls_main 893 847 -46
od_main 2797 2750 -47
readprofile_main 1944 1895 -49
tcpudpsvd_main 1973 1922 -51
udhcpc_main 2590 2513 -77
grep_main 824 722 -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/22 up/down: 23/-560) Total: -537 bytes
text data bss dec hex filename
796973 658 7428 805059 c48c3 busybox_old
796479 662 7420 804561 c46d1 busybox_unstripped
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); |