]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mountpoint: add --version & align with howto-usage-function.txt
authorSami Kerola <kerolasa@iki.fi>
Thu, 15 Mar 2012 21:24:41 +0000 (22:24 +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>
sys-utils/mountpoint.c

index a45cabdccfc7a9a5e1c472121a0baba1eeec6b9c..63a54469f5f54c5a59a3472e675490bb4b7baf99 100644 (file)
@@ -112,18 +112,19 @@ static int print_devno(const char *devname, struct stat *st)
 
 static void __attribute__((__noreturn__)) usage(FILE *out)
 {
-       fputs(_("\nUsage:\n"), out);
+       fputs(USAGE_HEADER, out);
        fprintf(out,
              _(" %1$s [-qd] /path/to/directory\n"
                " %1$s -x /dev/device\n"), program_invocation_short_name);
 
-       fputs(_("\nOptions:\n"), out);
+       fputs(USAGE_OPTIONS, out);
        fputs(_(" -q, --quiet        quiet mode - don't print anything\n"
                " -d, --fs-devno     print maj:min device number of the filesystem\n"
-               " -x, --devno        print maj:min device number of the block device\n"
-               " -h, --help         this help\n"), out);
-
-       fprintf(out, _("\nFor more information see mountpoint(1).\n"));
+               " -x, --devno        print maj:min device number of the block device\n"), out);
+       fputs(USAGE_SEPARATOR, out);
+       fputs(USAGE_HELP, out);
+       fputs(USAGE_VERSION, out);
+       fprintf(out, USAGE_MAN_TAIL("mountpoint(1)"));
 
        exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
@@ -139,6 +140,7 @@ int main(int argc, char **argv)
                { "fs-devno", 0, 0, 'd' },
                { "devno", 0, 0, 'x' },
                { "help", 0, 0, 'h' },
+               { "version", 0, 0, 'V' },
                { NULL, 0, 0, 0 }
        };
 
@@ -148,7 +150,7 @@ int main(int argc, char **argv)
 
        mnt_init_debug(0);
 
-       while ((c = getopt_long(argc, argv, "qdxh", longopts, NULL)) != -1) {
+       while ((c = getopt_long(argc, argv, "qdxhV", longopts, NULL)) != -1) {
 
                switch(c) {
                case 'q':
@@ -163,6 +165,9 @@ int main(int argc, char **argv)
                case 'h':
                        usage(stdout);
                        break;
+               case 'V':
+                       printf(UTIL_LINUX_VERSION);
+                       return EXIT_SUCCESS;
                default:
                        usage(stderr);
                        break;