diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-29 11:09:43 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-29 11:09:43 +0000 |
commit | c61852a02bd2d61682235ba3185173f527313827 (patch) | |
tree | 6af2895da70dda926317fac31cd4db6a4b20200c /coreutils | |
parent | 601ae1378ba7bb59e9c1a19fcc4ddd7bf9fb2e1b (diff) | |
download | busybox-w32-c61852a02bd2d61682235ba3185173f527313827.tar.gz busybox-w32-c61852a02bd2d61682235ba3185173f527313827.tar.bz2 busybox-w32-c61852a02bd2d61682235ba3185173f527313827.zip |
fix support for globally disabling --long-options.
(disabling them saves ~4K on fully configured bbox)
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/ls.c | 4 | ||||
-rw-r--r-- | coreutils/od_bloaty.c | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 79e47ee6b..960c161b0 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -648,10 +648,12 @@ static int list_single(struct dnode *dn) | |||
648 | #endif | 648 | #endif |
649 | case LIST_FILENAME: | 649 | case LIST_FILENAME: |
650 | errno = 0; | 650 | errno = 0; |
651 | #if ENABLE_FEATURE_LS_COLOR | ||
651 | if (show_color && !lstat(dn->fullname, &info)) { | 652 | if (show_color && !lstat(dn->fullname, &info)) { |
652 | printf("\033[%d;%dm", bgcolor(info.st_mode), | 653 | printf("\033[%d;%dm", bgcolor(info.st_mode), |
653 | fgcolor(info.st_mode)); | 654 | fgcolor(info.st_mode)); |
654 | } | 655 | } |
656 | #endif | ||
655 | column += printf("%s", dn->name); | 657 | column += printf("%s", dn->name); |
656 | if (show_color) { | 658 | if (show_color) { |
657 | printf("\033[0m"); | 659 | printf("\033[0m"); |
@@ -667,11 +669,13 @@ static int list_single(struct dnode *dn) | |||
667 | append = append_char(info.st_mode); | 669 | append = append_char(info.st_mode); |
668 | } | 670 | } |
669 | #endif | 671 | #endif |
672 | #if ENABLE_FEATURE_LS_COLOR | ||
670 | if (show_color) { | 673 | if (show_color) { |
671 | errno = 0; | 674 | errno = 0; |
672 | printf("\033[%d;%dm", bgcolor(info.st_mode), | 675 | printf("\033[%d;%dm", bgcolor(info.st_mode), |
673 | fgcolor(info.st_mode)); | 676 | fgcolor(info.st_mode)); |
674 | } | 677 | } |
678 | #endif | ||
675 | column += printf("%s", lpath) + 4; | 679 | column += printf("%s", lpath) + 4; |
676 | if (show_color) { | 680 | if (show_color) { |
677 | printf("\033[0m"); | 681 | printf("\033[0m"); |
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index dff7e3f50..b818521e4 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -858,6 +858,8 @@ format_address_std(off_t address, char c) | |||
858 | printf(address_fmt, address_pad_len, address); | 858 | printf(address_fmt, address_pad_len, address); |
859 | } | 859 | } |
860 | 860 | ||
861 | #if ENABLE_GETOPT_LONG | ||
862 | /* only used with --traditional */ | ||
861 | static void | 863 | static void |
862 | format_address_paren(off_t address, char c) | 864 | format_address_paren(off_t address, char c) |
863 | { | 865 | { |
@@ -872,7 +874,7 @@ format_address_label(off_t address, char c) | |||
872 | format_address_std(address, ' '); | 874 | format_address_std(address, ' '); |
873 | format_address_paren(address + pseudo_offset, c); | 875 | format_address_paren(address + pseudo_offset, c); |
874 | } | 876 | } |
875 | 877 | #endif | |
876 | 878 | ||
877 | static void | 879 | static void |
878 | dump_hexl_mode_trailer(size_t n_bytes, const char *block) | 880 | dump_hexl_mode_trailer(size_t n_bytes, const char *block) |
@@ -978,6 +980,7 @@ get_lcm(void) | |||
978 | return l_c_m; | 980 | return l_c_m; |
979 | } | 981 | } |
980 | 982 | ||
983 | #if ENABLE_GETOPT_LONG | ||
981 | /* If S is a valid traditional offset specification with an optional | 984 | /* If S is a valid traditional offset specification with an optional |
982 | leading '+' return nonzero and set *OFFSET to the offset it denotes. */ | 985 | leading '+' return nonzero and set *OFFSET to the offset it denotes. */ |
983 | 986 | ||
@@ -1011,6 +1014,7 @@ parse_old_offset(const char *s, off_t *offset) | |||
1011 | 1014 | ||
1012 | return (*offset >= 0); | 1015 | return (*offset >= 0); |
1013 | } | 1016 | } |
1017 | #endif | ||
1014 | 1018 | ||
1015 | /* Read a chunk of size BYTES_PER_BLOCK from the input files, write the | 1019 | /* Read a chunk of size BYTES_PER_BLOCK from the input files, write the |
1016 | formatted block to standard output, and repeat until the specified | 1020 | formatted block to standard output, and repeat until the specified |
@@ -1235,8 +1239,9 @@ od_main(int argc, char **argv) | |||
1235 | OPT_s = 1 << 15, | 1239 | OPT_s = 1 << 15, |
1236 | OPT_S = 1 << 16, | 1240 | OPT_S = 1 << 16, |
1237 | OPT_w = 1 << 17, | 1241 | OPT_w = 1 << 17, |
1238 | OPT_traditional = 1 << 18, | 1242 | OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG, |
1239 | }; | 1243 | }; |
1244 | #if ENABLE_GETOPT_LONG | ||
1240 | static const struct option long_options[] = { | 1245 | static const struct option long_options[] = { |
1241 | { "skip-bytes", required_argument, NULL, 'j' }, | 1246 | { "skip-bytes", required_argument, NULL, 'j' }, |
1242 | { "address-radix", required_argument, NULL, 'A' }, | 1247 | { "address-radix", required_argument, NULL, 'A' }, |
@@ -1248,6 +1253,7 @@ od_main(int argc, char **argv) | |||
1248 | { "traditional", no_argument, NULL, 0xff }, | 1253 | { "traditional", no_argument, NULL, 0xff }, |
1249 | { NULL, 0, NULL, 0 } | 1254 | { NULL, 0, NULL, 0 } |
1250 | }; | 1255 | }; |
1256 | #endif | ||
1251 | char *str_A, *str_N, *str_j, *str_S; | 1257 | char *str_A, *str_N, *str_j, *str_S; |
1252 | char *str_w = NULL; | 1258 | char *str_w = NULL; |
1253 | llist_t *lst_t = NULL; | 1259 | llist_t *lst_t = NULL; |
@@ -1260,7 +1266,9 @@ od_main(int argc, char **argv) | |||
1260 | 1266 | ||
1261 | /* Parse command line */ | 1267 | /* Parse command line */ |
1262 | opt_complementary = "t::"; // list | 1268 | opt_complementary = "t::"; // list |
1269 | #if ENABLE_GETOPT_LONG | ||
1263 | applet_long_options = long_options; | 1270 | applet_long_options = long_options; |
1271 | #endif | ||
1264 | opt = getopt32(argc, argv, "A:N:abcdfhij:lot:vxsS:" | 1272 | opt = getopt32(argc, argv, "A:N:abcdfhij:lot:vxsS:" |
1265 | "w::", // -w with optional param | 1273 | "w::", // -w with optional param |
1266 | // -S was -s and also had optional parameter | 1274 | // -S was -s and also had optional parameter |
@@ -1333,6 +1341,7 @@ od_main(int argc, char **argv) | |||
1333 | * FIXME: POSIX 1003.1-2001 with XSI requires support for the | 1341 | * FIXME: POSIX 1003.1-2001 with XSI requires support for the |
1334 | * traditional syntax even if --traditional is not given. */ | 1342 | * traditional syntax even if --traditional is not given. */ |
1335 | 1343 | ||
1344 | #if ENABLE_GETOPT_LONG | ||
1336 | if (opt & OPT_traditional) { | 1345 | if (opt & OPT_traditional) { |
1337 | off_t o1, o2; | 1346 | off_t o1, o2; |
1338 | 1347 | ||
@@ -1388,6 +1397,7 @@ od_main(int argc, char **argv) | |||
1388 | } | 1397 | } |
1389 | } | 1398 | } |
1390 | } | 1399 | } |
1400 | #endif | ||
1391 | 1401 | ||
1392 | if (limit_bytes_to_format) { | 1402 | if (limit_bytes_to_format) { |
1393 | end_offset = n_bytes_to_skip + max_bytes_to_format; | 1403 | end_offset = n_bytes_to_skip + max_bytes_to_format; |