summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-07-19 22:47:38 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-07-19 22:47:38 -0700
commit86fda0478065488dfc423b67ea1747817106335f (patch)
treef92e877f5e5a3f129331e039ed90c00e32f394bf
parent8d49ad3f03c858222863fa986de850d5a554d69f (diff)
Add -version flag
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xset.man7
-rw-r--r--xset.c7
2 files changed, 13 insertions, 1 deletions
diff --git a/man/xset.man b/man/xset.man
index ff46e9f..e9f1c5e 100644
--- a/man/xset.man
+++ b/man/xset.man
@@ -64,6 +64,8 @@ xset - user preference utility for X
[s {expose|noexpose}] [s {on|off}] [s default] [s activate] [s reset]
.br
[q]
+.br
+[-version]
.SH DESCRIPTION
This program is used to set various user preference options of the display.
.SH OPTIONS
@@ -282,6 +284,11 @@ If only one numerical parameter is given, it will be used for the length.
.B q
The \fBq\fP option gives you information on the current settings.
.PP
+.TP 8
+.B -version
+The \fB-version\fP option prints the program version and exits without
+doing anything else.
+.PP
These settings will be reset to default values when you log out.
.PP
Note that not all X implementations are guaranteed to honor all of these
diff --git a/xset.c b/xset.c
index 65f2c94..2301fa1 100644
--- a/xset.c
+++ b/xset.c
@@ -185,6 +185,9 @@ main(int argc, char *argv[])
if (++i >= argc)
usage("missing argument to -display");
disp = argv[i];
+ } else if (strcmp(arg, "-version") == 0) {
+ puts(PACKAGE_STRING);
+ exit(EXIT_SUCCESS);
} else {
hasargs = True;
}
@@ -1648,7 +1651,9 @@ usage(const char *fmt, ...)
"\t s blank s noblank s off\n"
"\t s expose s noexpose\n"
"\t s activate s reset\n"
- " For status information: q\n");
+ " For status information: q\n"
+ " To print version: -version\n"
+ );
exit(EXIT_SUCCESS);
}