diff --git a/src/df.c b/src/df.c index 41bda87..f4844e7 100644 --- a/src/df.c +++ b/src/df.c @@ -798,16 +798,22 @@ main (int argc, char **argv) posix_format = false; exit_status = EXIT_SUCCESS; - while ((c = getopt_long (argc, argv, "aB:iF:hHklmPTt:vx:", long_options, NULL)) - != -1) + while (true) { + int oi = -1; + int c = getopt_long (argc, argv, "aB:iF:hHklmPTt:vx:", long_options, &oi); + if (c == -1) + break; + switch (c) { case 'a': show_all_fs = true; break; case 'B': - human_output_opts = human_options (optarg, true, &output_block_size); + human_output_opts = + human_options (optarg, true, OPT_STR (oi, c, long_options), + &output_block_size); break; case 'i': inode_format = true; @@ -874,7 +880,7 @@ main (int argc, char **argv) } else human_output_opts = human_options (getenv ("DF_BLOCK_SIZE"), false, - &output_block_size); + NULL, &output_block_size); } /* Fail if the same file system type was both selected and excluded. */ diff --git a/src/du.c b/src/du.c index 57678d9..cbfbbb5 100644 --- a/src/du.c +++ b/src/du.c @@ -697,12 +697,17 @@ main (int argc, char **argv) exclude = new_exclude (); - human_output_opts = human_options (getenv ("DU_BLOCK_SIZE"), false, + human_output_opts = human_options (getenv ("DU_BLOCK_SIZE"), false, NULL, &output_block_size); - while ((c = getopt_long (argc, argv, DEBUG_OPT "0abchHklmsxB:DLPSX:", - long_options, NULL)) != -1) + while (true) { + int oi = -1; + int c = getopt_long (argc, argv, DEBUG_OPT "0abchHklmsxB:DLPSX:", + long_options, &oi); + if (c == -1) + break; + switch (c) { #if DU_DEBUG @@ -793,7 +798,9 @@ main (int argc, char **argv) break; case 'B': - human_output_opts = human_options (optarg, true, &output_block_size); + human_output_opts = + human_options (optarg, true, OPT_STR (oi, c, long_options), + &output_block_size); break; case 'D': /* This will eventually be 'H' (-H), too. */ diff --git a/src/ls.c b/src/ls.c index ee73622..c29b62a 100644 --- a/src/ls.c +++ b/src/ls.c @@ -1450,7 +1450,7 @@ decode_switches (int argc, char **argv) { char const *ls_block_size = getenv ("LS_BLOCK_SIZE"); - human_output_opts = human_options (ls_block_size, false, + human_output_opts = human_options (ls_block_size, false, NULL, &output_block_size); if (ls_block_size || getenv ("BLOCK_SIZE")) file_output_block_size = output_block_size; @@ -1506,10 +1506,15 @@ decode_switches (int argc, char **argv) } } - while ((c = getopt_long (argc, argv, - "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UXZ1", - long_options, NULL)) != -1) + while (true) { + int oi = -1; + int c = getopt_long (argc, argv, + "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UXZ1", + long_options, &oi); + if (c == -1) + break; + switch (c) { case 'a': @@ -1793,7 +1798,9 @@ decode_switches (int argc, char **argv) break; case BLOCK_SIZE_OPTION: - human_output_opts = human_options (optarg, true, &output_block_size); + human_output_opts = + human_options (optarg, true, OPT_STR (oi, c, long_options), + &output_block_size); file_output_block_size = output_block_size; break;