]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
docs: improve size arguments description in --help output
authorKarel Zak <kzak@redhat.com>
Wed, 5 Feb 2020 10:01:36 +0000 (11:01 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 5 Feb 2020 10:01:36 +0000 (11:01 +0100)
Let's add "Arguments:" section to the --help output and describe
{K,M,G...}iB suffixes there.

Addresses: https://github.com/karelzak/util-linux/pull/917
Co-Author: ed <ed@s5h.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
12 files changed:
disk-utils/fdisk.c
include/c.h
misc-utils/blkid.c
misc-utils/mcookie.c
misc-utils/wipefs.c
sys-utils/blkdiscard.c
sys-utils/blkzone.c
sys-utils/fallocate.c
sys-utils/fstrim.c
sys-utils/ipcmk.c
sys-utils/zramctl.c
text-utils/hexdump.c

index 0502fa33cf8a218d9dcb0ae6e113998dc7f40dcc..25e38fc387e69166ea3c92ad17a6865b6772b656 100644 (file)
@@ -878,7 +878,7 @@ int main(int argc, char **argv)
                { "color",          optional_argument, NULL, 'L' },
                { "compatibility",  optional_argument, NULL, 'c' },
                { "cylinders",      required_argument, NULL, 'C' },
-               { "heads",          required_argument, NULL, 'H' },
+               { "heads",          required_argument, NULL, 'H' },
                { "sectors",        required_argument, NULL, 'S' },
                { "getsz",          no_argument,       NULL, 's' },
                { "help",           no_argument,       NULL, 'h' },
index 59f88c7c48d77fcbd351ebbef448ab45977a3091..64cf5c3fb141e4bd3cc41bcbad319ea6e1614395 100644 (file)
@@ -363,6 +363,11 @@ static inline int xusleep(useconds_t usec)
                , " -h, --help",    USAGE_OPTSTR_HELP \
                , " -V, --version", USAGE_OPTSTR_VERSION
 
+#define USAGE_ARG_SEPARATOR    "\n"
+#define USAGE_ARG_SIZE(_name) \
+               _(" %s arguments may be followed by the suffixes for\n" \
+                 "   GiB, TiB, PiB, EiB, ZiB, and YiB (the \"iB\" is optional)\n"), _name
+
 #define USAGE_MAN_TAIL(_man)   _("\nFor more details see %s.\n"), _man
 
 #define UTIL_LINUX_VERSION _("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING
index 88a90578b030b1658860ed5fedadeefd3a3c11da..dba3bb7d7bbb1788cf01e8f0d0253e2de0a860c4 100644 (file)
@@ -86,7 +86,6 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(_(        " -l, --list-one             look up only first device with token specified by -t\n"), out);
        fputs(_(        " -L, --label <label>        convert LABEL to device name\n"), out);
        fputs(_(        " -U, --uuid <uuid>          convert UUID to device name\n"), out);
-       fputs(_(        " <dev>                      specify device(s) to probe (default: all devices)\n"), out);
        fputs(          "\n", out);
        fputs(_(        "Low-level probing options:\n"), out);
        fputs(_(        " -p, --probe                low-level superblocks probing (bypass cache)\n"), out);
@@ -99,6 +98,12 @@ static void __attribute__((__noreturn__)) usage(void)
 
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(28));
+
+       fputs(USAGE_ARGUMENTS, out);
+       printf(USAGE_ARG_SIZE(_("<size> and <offset>")));
+       fputs(USAGE_ARG_SEPARATOR, out);
+       fputs(_(" <dev> specify device(s) to probe (default: all devices)\n"), out);
+
        printf(USAGE_MAN_TAIL("blkid(8)"));
        exit(EXIT_SUCCESS);
 }
index f1680656a9026e5cd8a4237828a6637c9577f2be..549531454b51456fa0bb50f3d9b397734b81e288 100644 (file)
@@ -92,6 +92,10 @@ static void __attribute__((__noreturn__)) usage(void)
 
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(23));
+
+       fputs(USAGE_ARGUMENTS, out);
+       printf(USAGE_ARG_SIZE(_("<num>")));
+
        printf(USAGE_MAN_TAIL("mcookie(1)"));
 
        exit(EXIT_SUCCESS);
index 313ddc36e528e570dea595cab313e35025f72100..2a16d62229cef7f7f5ee6858ba8a3ce05e8a56cb 100644 (file)
@@ -658,6 +658,9 @@ usage(void)
 
        printf(USAGE_HELP_OPTIONS(21));
 
+       fputs(USAGE_ARGUMENTS, stdout);
+       printf(USAGE_ARG_SIZE(_("<num>")));
+
        fputs(USAGE_COLUMNS, stdout);
        for (i = 0; i < ARRAY_SIZE(infos); i++)
                fprintf(stdout, " %8s  %s\n", infos[i].name, _(infos[i].help));
index 589974f9c4bcb580943768adc1378f22c3cc74fd..e83f69b11f09f46e70cbc5cd4382b9a4a9dde114 100644 (file)
@@ -99,6 +99,9 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(21));
 
+       fputs(USAGE_ARGUMENTS, out);
+       printf(USAGE_ARG_SIZE(_("<num>")));
+
        printf(USAGE_MAN_TAIL("blkdiscard(8)"));
        exit(EXIT_SUCCESS);
 }
index dabc16f8825d114fed62798ee359ce1f22737ff0..715f03fefc6fc602f040d82e0c26c30b5d6a6361 100644 (file)
@@ -322,6 +322,9 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(24));
 
+       fputs(USAGE_ARGUMENTS, out);
+       printf(USAGE_ARG_SIZE(_("<sector> and <sectors>")));
+
        printf(USAGE_MAN_TAIL("blkzone(8)"));
        exit(EXIT_SUCCESS);
 }
index 15dcbb0a623212894072e3595012a8ce4938333d..014b94624760e4ea3ab4fc7243bd9cb986e4d2d1 100644 (file)
@@ -103,6 +103,9 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(22));
 
+       fputs(USAGE_ARGUMENTS, out);
+       printf(USAGE_ARG_SIZE(_("<num>")));
+
        printf(USAGE_MAN_TAIL("fallocate(1)"));
 
        exit(EXIT_SUCCESS);
index e6d7af3ea9fcf59d34439460e470bbf9698a3c06..6c84432426d3e7728422c0943a184c4b72349596 100644 (file)
@@ -396,6 +396,10 @@ static void __attribute__((__noreturn__)) usage(void)
 
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(21));
+
+       fputs(USAGE_ARGUMENTS, out);
+       printf(USAGE_ARG_SIZE(_("<num>")));
+
        printf(USAGE_MAN_TAIL("fstrim(8)"));
        exit(EXIT_SUCCESS);
 }
index 8aadffbbbacd69b3a8378eb24a80f202b0e0b2dd..5e942b77535389a34c02d65a10e21faa8c67476d 100644 (file)
@@ -77,6 +77,10 @@ static void __attribute__((__noreturn__)) usage(void)
 
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(26));
+
+       fputs(USAGE_ARGUMENTS, out);
+       printf(USAGE_ARG_SIZE(_("<size>")));
+
        printf(USAGE_MAN_TAIL("ipcmk(1)"));
 
        exit(EXIT_SUCCESS);
index 83c260db53875b22194d4e7fbef252f8a1c1cd6a..bc0d0d069eadd5ba72371909eddd20856cea01ef 100644 (file)
@@ -559,6 +559,9 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(27));
 
+       fputs(USAGE_ARGUMENTS, out);
+       printf(USAGE_ARG_SIZE(_("<size>")));
+
        fputs(USAGE_COLUMNS, out);
        for (i = 0; i < ARRAY_SIZE(infos); i++)
                fprintf(out, " %11s  %s\n", infos[i].name, _(infos[i].help));
index cbd593e5f97d14fa50f0aa9a4ff5a51b61436288..d7a54be5bd6f8192ac2305b51aabc9d93f62fe51 100644 (file)
@@ -172,10 +172,14 @@ void __attribute__((__noreturn__)) usage(void)
        fputs(_(" -n, --length <length>     interpret only length bytes of input\n"), out);
        fputs(_(" -s, --skip <offset>       skip offset bytes from the beginning\n"), out);
        fputs(_(" -v, --no-squeezing        output identical lines\n"), out);
+
        fputs(USAGE_SEPARATOR, out);
        printf(USAGE_HELP_OPTIONS(27));
-       printf(USAGE_MAN_TAIL("hexdump(1)"));
 
+       fputs(USAGE_ARGUMENTS, out);
+       printf(USAGE_ARG_SIZE(_("<length> and <offset>")));
+
+       printf(USAGE_MAN_TAIL("hexdump(1)"));
        exit(EXIT_SUCCESS);
 }