From 30b61b7bd7964c692caf0b726797504e0b25f8a0 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Thu, 15 Mar 2012 22:24:41 +0100 Subject: mountpoint: add --version & align with howto-usage-function.txt Signed-off-by: Sami Kerola --- sys-utils/mountpoint.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'sys-utils/mountpoint.c') diff --git a/sys-utils/mountpoint.c b/sys-utils/mountpoint.c index a45cabdcc..63a54469f 100644 --- a/sys-utils/mountpoint.c +++ b/sys-utils/mountpoint.c @@ -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; -- cgit v1.2.3-55-g7522