diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-07-13 23:49:45 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-07-13 23:49:45 +0200 |
commit | c72b43c2f07e5fae288fff9e220b1f88e2889a72 (patch) | |
tree | 4577ff27d4aefdb610b3e26fbf13651f8a01c81d /coreutils/split.c | |
parent | 0dacb68e1a660b235f9098abd33577be2e147c67 (diff) | |
download | busybox-w32-c72b43c2f07e5fae288fff9e220b1f88e2889a72.tar.gz busybox-w32-c72b43c2f07e5fae288fff9e220b1f88e2889a72.tar.bz2 busybox-w32-c72b43c2f07e5fae288fff9e220b1f88e2889a72.zip |
Commonalize typical [b,]k,m suffix struct
function old new delta
bkm_suffixes - 32 +32
static.km_suffixes 24 - -24
suffixes 32 - -32
static.bkm 32 - -32
head_tail_suffixes 32 - -32
------------------------------------------------------------------------------
(add/remove: 2/6 grow/shrink: 0/0 up/down: 72/-160) Total: -88 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/split.c')
-rw-r--r-- | coreutils/split.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/coreutils/split.c b/coreutils/split.c index 11e640442..1e1673efb 100644 --- a/coreutils/split.c +++ b/coreutils/split.c | |||
@@ -23,17 +23,15 @@ | |||
23 | 23 | ||
24 | #include "libbb.h" | 24 | #include "libbb.h" |
25 | 25 | ||
26 | static const struct suffix_mult split_suffices[] = { | ||
27 | #if ENABLE_FEATURE_SPLIT_FANCY | 26 | #if ENABLE_FEATURE_SPLIT_FANCY |
27 | static const struct suffix_mult split_suffixes[] = { | ||
28 | { "b", 512 }, | 28 | { "b", 512 }, |
29 | #endif | ||
30 | { "k", 1024 }, | 29 | { "k", 1024 }, |
31 | { "m", 1024*1024 }, | 30 | { "m", 1024*1024 }, |
32 | #if ENABLE_FEATURE_SPLIT_FANCY | ||
33 | { "g", 1024*1024*1024 }, | 31 | { "g", 1024*1024*1024 }, |
34 | #endif | ||
35 | { "", 0 } | 32 | { "", 0 } |
36 | }; | 33 | }; |
34 | #endif | ||
37 | 35 | ||
38 | /* Increment the suffix part of the filename. | 36 | /* Increment the suffix part of the filename. |
39 | * Returns NULL if we are out of filenames. | 37 | * Returns NULL if we are out of filenames. |
@@ -86,7 +84,10 @@ int split_main(int argc UNUSED_PARAM, char **argv) | |||
86 | if (opt & SPLIT_OPT_l) | 84 | if (opt & SPLIT_OPT_l) |
87 | cnt = XATOOFF(count_p); | 85 | cnt = XATOOFF(count_p); |
88 | if (opt & SPLIT_OPT_b) // FIXME: also needs XATOOFF | 86 | if (opt & SPLIT_OPT_b) // FIXME: also needs XATOOFF |
89 | cnt = xatoull_sfx(count_p, split_suffices); | 87 | cnt = xatoull_sfx(count_p, |
88 | IF_FEATURE_SPLIT_FANCY(split_suffixes) | ||
89 | IF_NOT_FEATURE_SPLIT_FANCY(km_suffixes) | ||
90 | ); | ||
90 | sfx = "x"; | 91 | sfx = "x"; |
91 | 92 | ||
92 | argv += optind; | 93 | argv += optind; |