Skip to content

Commit e93f3a2

Browse files
authored
Merge pull request #302 from fox0/df-1k
df: Fix -k option
2 parents 6841654 + 188d066 commit e93f3a2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/df.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,23 @@ pub enum OutputMode {
5959
/// The format of the default output from df is unspecified,
6060
/// but all space figures are reported in 512-byte units
6161
Unspecified,
62+
Unspecified1K,
6263
}
6364

6465
impl OutputMode {
6566
pub fn new(kilo: bool, portable: bool) -> Self {
6667
match (kilo, portable) {
6768
(true, true) => Self::Posix,
69+
(true, false) => Self::Unspecified1K,
6870
(false, true) => Self::PosixLegacy,
69-
_ => Self::Unspecified,
71+
(false, false) => Self::Unspecified,
7072
}
7173
}
7274

7375
pub fn get_block_size(&self) -> u64 {
7476
match self {
75-
OutputMode::Posix => 1024,
76-
OutputMode::PosixLegacy => 512,
77-
OutputMode::Unspecified => 512,
77+
OutputMode::Posix | OutputMode::Unspecified1K => 1024,
78+
OutputMode::PosixLegacy | OutputMode::Unspecified => 512,
7879
}
7980
}
8081
}

0 commit comments

Comments
 (0)