summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-05-23 23:01:51 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-05-23 23:01:51 -0700
commit79db3095004c912850455bddfc91bb0991ff6c75 (patch)
tree2a4c4ce4be491e916f50be9286c1f8805c49443e
parentf25c51fba6c7a08748892050c9db78e911e80ede (diff)
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xfs.man8
-rw-r--r--os/utils.c9
2 files changed, 15 insertions, 2 deletions
diff --git a/man/xfs.man b/man/xfs.man
index 08c9c54..cc4530b 100644
--- a/man/xfs.man
+++ b/man/xfs.man
@@ -64,6 +64,9 @@ xfs \- X font server
[
.BI "\-user " username
]
+[
+.B \-version
+]
.SH DESCRIPTION
.B xfs
is the X Window System font server.
@@ -167,6 +170,11 @@ for why this may be desired.
By default,
.B xfs
runs with the user and group IDs of the user who invoked it.
+.TP
+.B \-version
+instructs
+.B xfs
+to print the program version and exit.
.SH "INPUT FILES"
.B xfs
reads and serves any font file format recognized by the X server itself.
diff --git a/os/utils.c b/os/utils.c
index 9e209f5..a0bdef7 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -192,8 +192,9 @@ usage(const char *errmsg)
{
if (errmsg != NULL)
fprintf (stderr, "%s: %s\n", progname, errmsg);
- fprintf(stderr, "usage: %s [-config config_file] [-port tcp_port] [-droppriv] [-daemon] [-nodaemon] [-user user_name] [-ls listen_socket]\n",
- progname);
+ fprintf(stderr, "usage: %s [-config config_file] [-port tcp_port] [-droppriv] [-daemon] [-nodaemon] [-user user_name] [-ls listen_socket]\n"
+ " %s [-version]\n",
+ progname, progname);
exit(1);
}
@@ -328,6 +329,10 @@ ProcessCmdLine(int argc, char **argv)
else
usage("-config requires an argument");
}
+ else if (!strcmp(argv[i], "-version")) {
+ puts(PACKAGE_STRING);
+ exit(0);
+ }
else {
fprintf (stderr, "%s: unrecognized option %s\n", progname, argv[i]);
usage(NULL);