diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/head.c | 4 | ||||
-rw-r--r-- | coreutils/head_tail.c | 14 | ||||
-rw-r--r-- | coreutils/head_tail.h | 6 | ||||
-rw-r--r-- | coreutils/od_bloaty.c | 12 | ||||
-rw-r--r-- | coreutils/split.c | 11 | ||||
-rw-r--r-- | coreutils/tail.c | 4 |
6 files changed, 11 insertions, 40 deletions
diff --git a/coreutils/head.c b/coreutils/head.c index 291e1ce37..9388b026a 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -12,7 +12,6 @@ | |||
12 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */ | 12 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */ |
13 | 13 | ||
14 | //kbuild:lib-$(CONFIG_HEAD) += head.o | 14 | //kbuild:lib-$(CONFIG_HEAD) += head.o |
15 | //kbuild:lib-$(CONFIG_HEAD) += head_tail.o | ||
16 | 15 | ||
17 | //usage:#define head_trivial_usage | 16 | //usage:#define head_trivial_usage |
18 | //usage: "[OPTIONS] [FILE]..." | 17 | //usage: "[OPTIONS] [FILE]..." |
@@ -35,7 +34,6 @@ | |||
35 | //usage: "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n" | 34 | //usage: "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n" |
36 | 35 | ||
37 | #include "libbb.h" | 36 | #include "libbb.h" |
38 | #include "head_tail.h" | ||
39 | 37 | ||
40 | /* This is a NOEXEC applet. Be very careful! */ | 38 | /* This is a NOEXEC applet. Be very careful! */ |
41 | 39 | ||
@@ -140,7 +138,7 @@ eat_num(bool *negative_N, const char *p) | |||
140 | p++; | 138 | p++; |
141 | } | 139 | } |
142 | #endif | 140 | #endif |
143 | return xatoul_sfx(p, head_tail_suffixes); | 141 | return xatoul_sfx(p, bkm_suffixes); |
144 | } | 142 | } |
145 | 143 | ||
146 | static const char head_opts[] ALIGN1 = | 144 | static const char head_opts[] ALIGN1 = |
diff --git a/coreutils/head_tail.c b/coreutils/head_tail.c deleted file mode 100644 index 1658c0d1b..000000000 --- a/coreutils/head_tail.c +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Denys Vlasenko | ||
3 | * | ||
4 | * Licensed under GPLv2, see file LICENSE in this source tree. | ||
5 | */ | ||
6 | #include "libbb.h" | ||
7 | #include "head_tail.h" | ||
8 | |||
9 | const struct suffix_mult head_tail_suffixes[] = { | ||
10 | { "b", 512 }, | ||
11 | { "k", 1024 }, | ||
12 | { "m", 1024*1024 }, | ||
13 | { "", 0 } | ||
14 | }; | ||
diff --git a/coreutils/head_tail.h b/coreutils/head_tail.h deleted file mode 100644 index df19e41e0..000000000 --- a/coreutils/head_tail.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Denys Vlasenko | ||
3 | * | ||
4 | * Licensed under GPLv2, see file LICENSE in this source tree. | ||
5 | */ | ||
6 | extern const struct suffix_mult head_tail_suffixes[]; | ||
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index b408a8477..2c26dda16 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -1166,12 +1166,6 @@ parse_old_offset(const char *s, off_t *offset) | |||
1166 | int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 1166 | int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
1167 | int od_main(int argc UNUSED_PARAM, char **argv) | 1167 | int od_main(int argc UNUSED_PARAM, char **argv) |
1168 | { | 1168 | { |
1169 | static const struct suffix_mult bkm[] = { | ||
1170 | { "b", 512 }, | ||
1171 | { "k", 1024 }, | ||
1172 | { "m", 1024*1024 }, | ||
1173 | { "", 0 } | ||
1174 | }; | ||
1175 | #if ENABLE_LONG_OPTS | 1169 | #if ENABLE_LONG_OPTS |
1176 | static const char od_longopts[] ALIGN1 = | 1170 | static const char od_longopts[] ALIGN1 = |
1177 | "skip-bytes\0" Required_argument "j" | 1171 | "skip-bytes\0" Required_argument "j" |
@@ -1230,7 +1224,7 @@ int od_main(int argc UNUSED_PARAM, char **argv) | |||
1230 | address_pad_len_char = doxn_address_pad_len_char[pos]; | 1224 | address_pad_len_char = doxn_address_pad_len_char[pos]; |
1231 | } | 1225 | } |
1232 | if (opt & OPT_N) { | 1226 | if (opt & OPT_N) { |
1233 | max_bytes_to_format = xstrtooff_sfx(str_N, 0, bkm); | 1227 | max_bytes_to_format = xstrtooff_sfx(str_N, 0, bkm_suffixes); |
1234 | } | 1228 | } |
1235 | if (opt & OPT_a) decode_format_string("a"); | 1229 | if (opt & OPT_a) decode_format_string("a"); |
1236 | if (opt & OPT_b) decode_format_string("oC"); | 1230 | if (opt & OPT_b) decode_format_string("oC"); |
@@ -1239,7 +1233,7 @@ int od_main(int argc UNUSED_PARAM, char **argv) | |||
1239 | if (opt & OPT_f) decode_format_string("fF"); | 1233 | if (opt & OPT_f) decode_format_string("fF"); |
1240 | if (opt & OPT_h) decode_format_string("x2"); | 1234 | if (opt & OPT_h) decode_format_string("x2"); |
1241 | if (opt & OPT_i) decode_format_string("d2"); | 1235 | if (opt & OPT_i) decode_format_string("d2"); |
1242 | if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm); | 1236 | if (opt & OPT_j) n_bytes_to_skip = xstrtooff_sfx(str_j, 0, bkm_suffixes); |
1243 | if (opt & OPT_l) decode_format_string("d4"); | 1237 | if (opt & OPT_l) decode_format_string("d4"); |
1244 | if (opt & OPT_o) decode_format_string("o2"); | 1238 | if (opt & OPT_o) decode_format_string("o2"); |
1245 | while (lst_t) { | 1239 | while (lst_t) { |
@@ -1248,7 +1242,7 @@ int od_main(int argc UNUSED_PARAM, char **argv) | |||
1248 | if (opt & OPT_x) decode_format_string("x2"); | 1242 | if (opt & OPT_x) decode_format_string("x2"); |
1249 | if (opt & OPT_s) decode_format_string("d2"); | 1243 | if (opt & OPT_s) decode_format_string("d2"); |
1250 | if (opt & OPT_S) { | 1244 | if (opt & OPT_S) { |
1251 | string_min = xstrtou_sfx(str_S, 0, bkm); | 1245 | string_min = xstrtou_sfx(str_S, 0, bkm_suffixes); |
1252 | } | 1246 | } |
1253 | 1247 | ||
1254 | // Bloat: | 1248 | // Bloat: |
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; |
diff --git a/coreutils/tail.c b/coreutils/tail.c index c9f9d00f6..07c71ca4b 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -25,7 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | //kbuild:lib-$(CONFIG_TAIL) += tail.o | 27 | //kbuild:lib-$(CONFIG_TAIL) += tail.o |
28 | //kbuild:lib-$(CONFIG_TAIL) += head_tail.o | ||
29 | 28 | ||
30 | //usage:#define tail_trivial_usage | 29 | //usage:#define tail_trivial_usage |
31 | //usage: "[OPTIONS] [FILE]..." | 30 | //usage: "[OPTIONS] [FILE]..." |
@@ -51,7 +50,6 @@ | |||
51 | //usage: "nameserver 10.0.0.1\n" | 50 | //usage: "nameserver 10.0.0.1\n" |
52 | 51 | ||
53 | #include "libbb.h" | 52 | #include "libbb.h" |
54 | #include "head_tail.h" | ||
55 | 53 | ||
56 | struct globals { | 54 | struct globals { |
57 | bool from_top; | 55 | bool from_top; |
@@ -89,7 +87,7 @@ static unsigned eat_num(const char *p) | |||
89 | p++; | 87 | p++; |
90 | G.from_top = 1; | 88 | G.from_top = 1; |
91 | } | 89 | } |
92 | return xatou_sfx(p, head_tail_suffixes); | 90 | return xatou_sfx(p, bkm_suffixes); |
93 | } | 91 | } |
94 | 92 | ||
95 | int tail_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 93 | int tail_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |