From: Sami Kerola Date: Sat, 11 Jun 2011 13:07:10 +0000 (+0200) Subject: namei: add --version option X-Git-Tag: v2.20-rc1~138^2~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64718fe7d9dd038c5d472c24cfa4be09e0bb45f7;p=thirdparty%2Futil-linux.git namei: add --version option Add to namei.1 man also the --help option along with the new --version. Signed-off-by: Sami Kerola --- diff --git a/misc-utils/namei.1 b/misc-utils/namei.1 index 82f5d784f6..8e97c18ecb 100644 --- a/misc-utils/namei.1 +++ b/misc-utils/namei.1 @@ -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 diff --git a/misc-utils/namei.c b/misc-utils/namei.c index aacaa10d11..f133e40fa5 100644 --- a/misc-utils/namei.c +++ b/misc-utils/namei.c @@ -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;