]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
blockdev: improve --help and man page
authorRuediger Meier <ruediger.meier@ga-group.nl>
Sun, 25 Jun 2017 18:43:44 +0000 (20:43 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 27 Jun 2017 10:28:44 +0000 (12:28 +0200)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
disk-utils/blockdev.8
disk-utils/blockdev.c

index c9eeb9b41ea75966316628a8bf6c773afa82ebfa..0f3291391cc95600dd29689f0041e2ba2d256e11 100644 (file)
@@ -17,13 +17,14 @@ blockdev \- call block device ioctls from the command line
 .B blockdev
 .B \-\-report
 .RI [ device \&...\&]
+.br
+.B blockdev
+.RB \-h | \-V
 .SH DESCRIPTION
 The utility
 .B blockdev
 allows one to call block device ioctls from the command line.
 .SH OPTIONS
-.IP "\fB\-V\fP"
-Print version and exit.
 .IP "\fB\-q\fP"
 Be quiet.
 .IP "\fB\-v\fP"
@@ -32,6 +33,10 @@ Be verbose.
 Print a report for the specified device. It is possible to give multiple
 devices. If none is given, all devices which appear in /proc/partitions are
 shown. Note that the partition StartSec is in 512-byte sectors.
+.IP "\fB\-h\fR, \fB\-\-help\fR"
+Display help text and exit.
+.IP "\fB\-V\fR, \fB\-\-version\fR"
+Print version and exit.
 .SH COMMANDS
 It is possible to give multiple devices and multiple commands.
 .IP "\fB\-\-flushbufs\fP"
index 4760e021b9f25f1e7d3cec97b6f371d8f91e71f5..ed018a7bf4235ca4365291c5d4aad9624c77c1c0 100644 (file)
@@ -180,27 +180,39 @@ static const struct bdc bdcms[] =
 
 static void __attribute__((__noreturn__)) usage(void)
 {
-       FILE * out = stdout;
        size_t i;
 
-       fprintf(out, _("\nUsage:\n"
-                      " %1$s -V\n"
-                      " %1$s --report [devices]\n"
-                      " %1$s [-v|-q] commands devices\n\n"
-                      "Available commands:\n"), program_invocation_short_name);
-
-       fprintf(out, _(" %-25s get size in 512-byte sectors\n"), "--getsz");
+       fputs(USAGE_HEADER, stdout);
+       printf(_(
+                " %1$s [-v|-q] commands devices\n"
+                " %1$s --report [devices]\n"
+                " %1$s -h|-V\n"
+               ), program_invocation_short_name);
+
+       fputs(USAGE_SEPARATOR, stdout);
+       puts(  _("Call block device ioctls from the command line."));
+
+       fputs(USAGE_OPTIONS, stdout);
+       puts(  _(" -q             quiet mode"));
+       puts(  _(" -v             verbose mode"));
+       puts(  _("     --report   print report for specified (or all) devices"));
+       fputs(USAGE_SEPARATOR, stdout);
+       print_usage_help_options(16);
+
+       fputs(USAGE_SEPARATOR, stdout);
+       puts(  _("Available commands:"));
+       printf(_(" %-25s get size in 512-byte sectors\n"), "--getsz");
        for (i = 0; i < ARRAY_SIZE(bdcms); i++) {
                if (bdcms[i].argname)
-                       fprintf(out, " %s %-*s %s\n", bdcms[i].name,
+                       printf(" %s %-*s %s\n", bdcms[i].name,
                                (int)(24 - strlen(bdcms[i].name)),
                                bdcms[i].argname, _(bdcms[i].help));
                else
-                       fprintf(out, " %-25s %s\n", bdcms[i].name,
+                       printf(" %-25s %s\n", bdcms[i].name,
                                _(bdcms[i].help));
        }
 
-       fprintf(out, USAGE_MAN_TAIL("blockdev(1)"));
+       printf(USAGE_MAN_TAIL("blockdev(1)"));
        exit(EXIT_SUCCESS);
 }