diff options
Diffstat (limited to 'coreutils/od_bloaty.c')
-rw-r--r-- | coreutils/od_bloaty.c | 14 |
1 files changed, 12 insertions, 2 deletions
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; |