aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorDaniel Santana <daniel@santana.tech>2021-03-11 18:51:21 -0300
committerRob Landley <rob@landley.net>2021-03-12 01:04:38 -0600
commit8c2825c496ae4fb91483dee68d5c171ba6c0fd77 (patch)
tree5c49252fb18bcfce9411649182de3aeee58ec0ef /toys/posix
parent5f9d1f5bb59b1f129596bccb1928ce22d351f7c9 (diff)
downloadtoybox-8c2825c496ae4fb91483dee68d5c171ba6c0fd77.tar.gz
df: Allow -P + -k together as defined in POSIX
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/df.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/toys/posix/df.c b/toys/posix/df.c
index 0520923e..b8f298ff 100644
--- a/toys/posix/df.c
+++ b/toys/posix/df.c
@@ -4,7 +4,7 @@
*
* See http://opengroup.org/onlinepubs/9699919799/utilities/df.html
-USE_DF(NEWTOY(df, "HPkhit*a[-HPkh]", TOYFLAG_SBIN))
+USE_DF(NEWTOY(df, "HPkhit*a[-HPh]", TOYFLAG_SBIN))
config DF
bool "df"
@@ -63,7 +63,8 @@ static void print_header()
sizeof(char *)*4);
else {
if (!(FLAG(H)||FLAG(h))) {
- dsuapm[1] = TT.units == 512 ? "512-blocks" : "1K-blocks";
+ dsuapm[1] = TT.units == 512 ? "512-blocks" :
+ FLAG(P) ? "1024-blocks" : "1K-blocks";
dsuapm[3] = "Available";
if (FLAG(P)) dsuapm[4] = "Capacity";
}
@@ -142,7 +143,7 @@ void df_main(void)
// Units are 512 bytes if you select "pedantic" without "kilobytes".
if (FLAG(H)||FLAG(h)||FLAG(i)) TT.units = 1;
- else TT.units = FLAG(P) ? 512 : 1024;
+ else TT.units = FLAG(P) && !FLAG(k) ? 512 : 1024;
if (!(mtstart = xgetmountlist(0))) return;
mtend = dlist_terminate(mtstart);