summaryrefslogtreecommitdiffhomepage
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-06-20 14:46:19 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-06-20 14:46:19 +0200
commita2a9113f35741f9d01f0b5fd5d45d6387681fdb5 (patch)
treef0533b6ae732209c79b489591410a3ffc9d02028 /coreutils
parentd71c7892ac56939cfcf3fa699ee8b0195631ee5a (diff)
df: POSIXLY_CORRECT sets _default_ scale, -m/-h overrides it
function old new delta df_main 1034 1029 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/df.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/coreutils/df.c b/coreutils/df.c
index debb86867..a659353c0 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -113,6 +113,13 @@ int df_main(int argc UNUSED_PARAM, char **argv)
init_unicode();
+ /* From the manpage of df from coreutils-6.10:
+ * Disk space is shown in 1K blocks by default, unless the environment
+ * variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
+ */
+ if (getenv("POSIXLY_CORRECT")) /* TODO - a new libbb function? */
+ df_disp_hr = 512;
+
opt = getopt32(argv, "^"
"kPT"
IF_FEATURE_DF_FANCY("aiB:")
@@ -142,13 +149,6 @@ int df_main(int argc UNUSED_PARAM, char **argv)
got_it: ;
}
- /* From the manpage of df from coreutils-6.10:
- * Disk space is shown in 1K blocks by default, unless the environment
- * variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
- */
- if (getenv("POSIXLY_CORRECT")) /* TODO - a new libbb function? */
- df_disp_hr = 512;
-
if (opt & OPT_HUMAN) {
df_disp_hr = 0;
disp_units_hdr = " Size";