diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-11 01:47:03 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-11 01:47:03 +0300 |
commit | 9346ea9550887ee81de4df3731f8d4ff533f4aed (patch) | |
tree | e04ea56c93d24b39edbf2cf2ad7c6aa7f80c58ed /coreutils | |
parent | 40f2dd7dd2e50c9d81dda4d72bf9c85c4c479a89 (diff) |
df: "support" -H as an alias of -h
function old new delta
df_main 1065 1068 +3
.rodata 104232 104233 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 4/0) Total: 4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/df.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/coreutils/df.c b/coreutils/df.c index e8d4bc8f2..9f8b3a71e 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -99,15 +99,16 @@ int df_main(int argc UNUSED_PARAM, char **argv) struct mntent *mount_entry; struct statvfs s; enum { - OPT_KILO = (1 << 0), - OPT_POSIX = (1 << 1), - OPT_FSTYPE = (1 << 2), - OPT_t = (1 << 3), - OPT_ALL = (1 << 4) * ENABLE_FEATURE_DF_FANCY, - OPT_INODE = (1 << 5) * ENABLE_FEATURE_DF_FANCY, - OPT_BSIZE = (1 << 6) * ENABLE_FEATURE_DF_FANCY, - OPT_HUMAN = (1 << (4 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE, - OPT_MEGA = (1 << (5 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE, + OPT_KILO = (1 << 0), + OPT_POSIX = (1 << 1), + OPT_FSTYPE = (1 << 2), + OPT_t = (1 << 3), + OPT_ALL = (1 << 4) * ENABLE_FEATURE_DF_FANCY, + OPT_INODE = (1 << 5) * ENABLE_FEATURE_DF_FANCY, + OPT_BSIZE = (1 << 6) * ENABLE_FEATURE_DF_FANCY, + OPT_HUMAN = (1 << (4 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE, + OPT_HUMANDEC = (1 << (5 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE, + OPT_MEGA = (1 << (6 + 3*ENABLE_FEATURE_DF_FANCY)) * ENABLE_FEATURE_HUMAN_READABLE, }; const char *disp_units_hdr = NULL; char *chp, *opt_t; @@ -124,7 +125,7 @@ int df_main(int argc UNUSED_PARAM, char **argv) opt = getopt32(argv, "^" "kPTt:" IF_FEATURE_DF_FANCY("aiB:") - IF_FEATURE_HUMAN_READABLE("hm") + IF_FEATURE_HUMAN_READABLE("hHm") "\0" #if ENABLE_FEATURE_HUMAN_READABLE && ENABLE_FEATURE_DF_FANCY "k-mB:m-Bk:B-km" @@ -151,8 +152,11 @@ int df_main(int argc UNUSED_PARAM, char **argv) got_it: ; } - if (opt & OPT_HUMAN) { + if (opt & (OPT_HUMAN|OPT_HUMANDEC)) { df_disp_hr = 0; +//TODO: need to add support in make_human_readable_str() for "decimal human readable" + //if (opt & OPT_HUMANDEC) + // df_disp_hr--; disp_units_hdr = " Size"; } if (opt & OPT_INODE) |