docs: improve size arguments description in --help output

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>
This commit is contained in:
Karel Zak 2020-02-05 11:01:36 +01:00
parent 67f938bfba
commit f1970cc557
12 changed files with 44 additions and 3 deletions

View 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' },

View 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

View 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);
}

View 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);

View 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));

View 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);
}

View 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);
}

View 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);

View 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);
}

View 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);

View 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));

View 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);
}