>From 13bb95c51ac307cf008595971de4b47baa127dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Mon, 3 Mar 2014 02:49:25 +0000 Subject: [PATCH] doc: improve df --human and --si, help and man page * src/df.c (usage): Adjust the --human and --si descriptions to not depend on each other. Also include an example that is illustrative of the rounding, suffix, width, and localized fractions. Fixes http://bugs.gnu.org/16922 --- src/df.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/df.c b/src/df.c index e4fafb9..7143ff2 100644 --- a/src/df.c +++ b/src/df.c @@ -1252,6 +1252,18 @@ usage (int status) emit_try_help (); else { + const int example_size = 1023*1024*1024; + + int opts = human_autoscale; + + opts |= human_SI; + char si_buf[LONGEST_HUMAN_READABLE + 1]; + char const *si = human_readable (example_size, si_buf, opts, 1, 1); + + opts |= human_base_1024; + char human_buf[LONGEST_HUMAN_READABLE + 1]; + char const *human = human_readable (example_size, human_buf, opts, 1, 1); + printf (_("Usage: %s [OPTION]... [FILE]...\n"), program_name); fputs (_("\ Show information about the file system on which each FILE resides,\n\ @@ -1260,16 +1272,15 @@ or all file systems by default.\n\ emit_mandatory_arg_note (); - fputs (_("\ + printf (_("\ -a, --all include dummy file systems\n\ -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ '-BM' prints sizes in units of 1,048,576 bytes;\n\ see SIZE format below\n\ --total produce a grand total\n\ - -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\ -\n\ - -H, --si likewise, but use powers of 1000 not 1024\n\ -"), stdout); + -h, --human-readable print abbreviated sizes in powers of 1024 (e.g. %s)\n\ + -H, --si print abbreviated sizes in powers of 1000 (e.g. %s)\n\ +"), human, si); fputs (_("\ -i, --inodes list inode information instead of block usage\n\ -k like --block-size=1K\n\ -- 1.7.7.6