diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-05-23 23:13:30 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-05-23 23:13:30 -0700 |
commit | b79192e409347d36e06b91530d75fba4acc799d9 (patch) | |
tree | 1f8d0c5904c8069948f7c2106ccab1feae7e4db1 | |
parent | 5d579a475beb6083c5321ea2293b7ec5c4328a62 (diff) |
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | man/xfsinfo.man | 3 | ||||
-rw-r--r-- | xfsinfo.c | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/man/xfsinfo.man b/man/xfsinfo.man index e803e30..908f256 100644 --- a/man/xfsinfo.man +++ b/man/xfsinfo.man @@ -48,6 +48,9 @@ must be specified in one of the formats defined in the section of X(__miscmansuffix__). If not specified, the server name in the .B FONTSERVER environment variable is used. +.TP +.B \-version +This option prints the program version and exits. .SH HISTORY .I Xfsinfo was originally called @@ -56,6 +56,10 @@ from The Open Group. * */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> #include <X11/Xos.h> @@ -71,7 +75,7 @@ static char *progname; static void _X_NORETURN usage(void) { - fprintf(stderr, "usage: %s [-server server_name]\n", progname); + fprintf(stderr, "usage: %s [-server server_name] [-version]\n", progname); exit(-1); } @@ -92,6 +96,9 @@ main(int argc, char *argv[]) usage(); } servername = argv[i]; + } else if (strcmp(argv[i], "-version") == 0) { + puts(PACKAGE_STRING); + exit(0); } else { fprintf (stderr, "%s: unrecognized argument %s\n", progname, argv[i]); |