]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
partx: add --version option
authorSami Kerola <kerolasa@iki.fi>
Thu, 15 Mar 2012 22:12:30 +0000 (23:12 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 30 Mar 2012 14:48:12 +0000 (16:48 +0200)
Th commit 8275b7326e535c6d745414baca680f03e9eccdf3 added --version to
usage() but not as working option.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
partx/partx.c

index ddce6fe4e461e175fd7523101e33bb0b212f7ba5..0c46af6ebfc2aca290a2d800e1dc2d35bc7326f2 100644 (file)
@@ -659,6 +659,7 @@ int main(int argc, char **argv)
                { "output",     required_argument, NULL, 'o' },
                { "pairs",      no_argument,       NULL, 'P' },
                { "help",       no_argument,       NULL, 'h' },
+               { "version",    no_argument,       NULL, 'V' },
                { "verbose",    no_argument,       NULL, 'v' },
                { NULL, 0, NULL, 0 }
        };
@@ -668,7 +669,7 @@ int main(int argc, char **argv)
        textdomain(PACKAGE);
 
        while ((c = getopt_long(argc, argv,
-                               "abdglrsvn:t:o:Ph", long_opts, NULL)) != -1) {
+                               "abdglrsvn:t:o:PhV", long_opts, NULL)) != -1) {
 
                switch(c) {
                case 'a':
@@ -728,6 +729,9 @@ int main(int argc, char **argv)
                        break;
                case 'h':
                        usage(stdout);
+               case 'V':
+                       printf(UTIL_LINUX_VERSION);
+                       return EXIT_SUCCESS;
                case '?':
                default:
                        usage(stderr);