From 817d0261eb5493c626e07f570bd28c155857b584 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 27 Feb 2007 19:12:08 +0100 Subject: Make df -P immune to effects of e.g., the BLOCK_SIZE envvar. * NEWS: With -P, the default block size and output format is not affected by DF_BLOCK_SIZE, BLOCK_SIZE, or BLOCKSIZE. * src/df.c (main): Implement this. * doc/coreutils.texi (df invocation): With -P, the default block size and output format is not affected by DF_BLOCK_SIZE, BLOCK_SIZE, or BLOCKSIZE. --- src/df.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/df.c b/src/df.c index 8bc4a84c9..609787eea 100644 --- a/src/df.c +++ b/src/df.c @@ -796,10 +796,7 @@ main (int argc, char **argv) inode_format = false; show_all_fs = false; show_listed_fs = false; - - human_output_opts = human_options (getenv ("DF_BLOCK_SIZE"), false, - &output_block_size); - + human_output_opts = -1; print_type = false; file_systems_processed = false; posix_format = false; @@ -876,6 +873,18 @@ main (int argc, char **argv) } } + if (human_output_opts == -1) + { + if (posix_format) + { + human_output_opts = 0; + output_block_size = (getenv ("POSIXLY_CORRECT") ? 512 : 1024); + } + else + human_output_opts = human_options (getenv ("DF_BLOCK_SIZE"), false, + &output_block_size); + } + /* Fail if the same file system type was both selected and excluded. */ { bool match = false; -- cgit v1.2.3-54-g00ecf