]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: add --version & align with howto-usage-function.txt
authorSami Kerola <kerolasa@iki.fi>
Thu, 15 Mar 2012 21:32:48 +0000 (22:32 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 30 Mar 2012 14:48:11 +0000 (16:48 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
misc-utils/findmnt.c

index 476263c27c7510e513171ff3f0b87c6d6f86cc8b..d9b645c470d42d19105cb0c6e5abf09fc5024852 100644 (file)
@@ -876,8 +876,8 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
 {
        int i;
 
+       fputs(USAGE_HEADER, out);
        fprintf(out, _(
-       "\nUsage:\n"
        " %1$s [options]\n"
        " %1$s [options] <device> | <mountpoint>\n"
        " %1$s [options] <device> <mountpoint>\n"
@@ -921,16 +921,18 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
        " -v, --nofsroot         don't print [/dir] for bind or btrfs mounts\n"
        " -R, --submounts        print all submounts for the matching filesystems\n"
        " -S, --source <string>  the device to mount (by name, LABEL= or UUID=)\n"
-       " -T, --target <string>  the mountpoint to use\n\n"));
+       " -T, --target <string>  the mountpoint to use\n"));
 
+       fputs(USAGE_SEPARATOR, out);
+       fputs(USAGE_HELP, out);
+       fputs(USAGE_VERSION, out);
 
        fprintf(out, _("\nAvailable columns:\n"));
 
        for (i = 0; i < FINDMNT_NCOLUMNS; i++)
                fprintf(out, " %11s  %s\n", infos[i].name, _(infos[i].help));
 
-
-       fprintf(out, _("\nFor more information see findmnt(1).\n"));
+       fprintf(out, USAGE_MAN_TAIL("findmnt(1)"));
 
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
@@ -980,6 +982,7 @@ int main(int argc, char *argv[])
            { "tab-file",     1, 0, 'F' },
            { "target",       1, 0, 'T' },
            { "timeout",      1, 0, 'w' },
+           { "version",      0, 0, 'V' },
 
            { NULL,           0, 0, 0 }
        };
@@ -994,7 +997,7 @@ int main(int argc, char *argv[])
        tt_flags |= TT_FL_TREE;
 
        while ((c = getopt_long(argc, argv,
-                               "AacDd:ehifF:o:O:p::Pklmnrst:uvRS:T:w:",
+                               "AacDd:ehifF:o:O:p::Pklmnrst:uvRS:T:w:V",
                                longopts, NULL)) != -1) {
                switch(c) {
                case 'A':
@@ -1113,6 +1116,9 @@ int main(int argc, char *argv[])
                        timeout = strtol_or_err(optarg,
                                        _("failed to parse timeout"));
                        break;
+               case 'V':
+                       printf(UTIL_LINUX_VERSION);
+                       return EXIT_SUCCESS;
                default:
                        usage(stderr);
                        break;