diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2007-02-27 19:12:08 +0100 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-02-27 19:33:03 +0100 |
commit | 817d0261eb5493c626e07f570bd28c155857b584 (patch) | |
tree | c7dfb6248822d460698ed38d8e4930eb304a802b /src | |
parent | 898d3df2f803f9d8c6967affee6a0e4ae6f89f13 (diff) | |
download | coreutils-817d0261eb5493c626e07f570bd28c155857b584.tar.xz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/df.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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; |