]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
namei: add --version option
authorSami Kerola <kerolasa@iki.fi>
Sat, 11 Jun 2011 13:07:10 +0000 (15:07 +0200)
committerSami Kerola <kerolasa@iki.fi>
Sat, 25 Jun 2011 10:37:04 +0000 (12:37 +0200)
Add to namei.1 man also the --help option along with the new
--version.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
misc-utils/namei.1
misc-utils/namei.c

index 82f5d784f6c796d64b9235af3d49194185d56cc3..8e97c18ecbfa3841c7d8add612a3f874922f785f 100644 (file)
@@ -54,6 +54,10 @@ Don't follow symlinks.
 Vertically align the modes and owners.
 .IP "\fB\-x, \-\-mountpoints\fP"
 Show mountpoint directories with a 'D' rather than a 'd'.
+.IP "\fB\-h\fR, \fB\-\-help\fR"
+Output help text and exit.
+.IP "\fB\-V\fR, \fB\-\-version\fR"
+Output version information and exit.
 .SH AUTHOR
 The original
 .B namei
index aacaa10d11a7e6fa7f42dd86551db27cc3c29d7d..f133e40fa51325ef7896d3c3f66b31a37362eac3 100644 (file)
@@ -427,6 +427,7 @@ usage(int rc)
 
        printf(_(
        " -h, --help          displays this help text\n"
+       " -V, --version       output version information and exit\n"
        " -x, --mountpoints   show mount point directories with a 'D'\n"
        " -m, --modes         show the mode bits of each file\n"
        " -o, --owners        show owner and group name of each file\n"
@@ -441,6 +442,7 @@ usage(int rc)
 static const struct option longopts[] =
 {
        { "help",       0, 0, 'h' },
+       { "version",    0, 0, 'V' },
        { "mountpoints",0, 0, 'x' },
        { "modes",      0, 0, 'm' },
        { "owners",     0, 0, 'o' },
@@ -464,12 +466,16 @@ main(int argc, char **argv)
        if (argc < 2)
                usage(EXIT_FAILURE);
 
-       while ((c = getopt_long(argc, argv, "+h?lmnovx", longopts, NULL)) != -1) {
+       while ((c = getopt_long(argc, argv, "+h?Vlmnovx", longopts, NULL)) != -1) {
                switch(c) {
                case 'h':
                case '?':
                        usage(EXIT_SUCCESS);
                        break;
+               case 'V':
+                       printf(_("%s from %s\n"), program_invocation_short_name,
+                                                 PACKAGE_STRING);
+                       return EXIT_SUCCESS;
                case 'l':
                        flags |= (NAMEI_OWNERS | NAMEI_MODES | NAMEI_VERTICAL);
                        break;