summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-01-13 11:06:39 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-01-13 11:08:46 -0800
commitd8cb397df5ecb94e7b0ea05d2407f4334a36eb87 (patch)
tree5f6b8c0a8ce198bee718fb5b1d8f3d736072079f
parent1636536e4d158e994f045133267ae9b4b278c4f3 (diff)
Add -version option
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xsetroot.man4
-rw-r--r--xsetroot.c11
2 files changed, 13 insertions, 2 deletions
diff --git a/man/xsetroot.man b/man/xsetroot.man
index 26bcfee..b58b39d 100644
--- a/man/xsetroot.man
+++ b/man/xsetroot.man
@@ -27,7 +27,7 @@
xsetroot \- root window parameter setting utility for X
.SH SYNOPSIS
.B xsetroot
-[-help] [-def] [-display \fIdisplay\fP]
+[-help] [-version] [-def] [-display \fIdisplay\fP]
[-cursor \fIcursorfile maskfile\fP]
[-cursor_name \fIcursorname\fP]
[-xcf \fIcursorfile\fP \fIcursorsize\fP]
@@ -58,6 +58,8 @@ Only one of the background color/tiling changing options
The various options are as follows:
.IP \fB-help\fP
Print a usage message and exit.
+.IP \fB-verson\fP
+Print a version message and exit.
.IP \fB-def\fP
Reset unspecified attributes to the default values. (Restores the background
to the familiar gray mesh and the cursor to the hollow x shape.)
diff --git a/xsetroot.c b/xsetroot.c
index 40f0267..3bf27d8 100644
--- a/xsetroot.c
+++ b/xsetroot.c
@@ -32,6 +32,10 @@ in this Software without prior written authorization from The Open Group.
* 11-Jun-87
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
@@ -75,7 +79,6 @@ usage(void)
" -fg <color> or -foreground <color>\n"
" -bg <color> or -background <color>\n"
" -rv or -reverse\n"
- " -help\n"
" -def or -default\n"
" -name <string>\n"
" -cursor <cursor file> <mask file>\n"
@@ -85,6 +88,8 @@ usage(void)
" -gray or -grey\n"
" -bitmap <filename>\n"
" -mod <x> <y>\n"
+ " -help\n"
+ " -version\n"
);
exit(1);
/*NOTREACHED*/
@@ -125,6 +130,10 @@ main(int argc, char *argv[])
if (!strcmp("-help", argv[i])) {
usage();
}
+ if (!strcmp("-version", argv[i])) {
+ printf("%s\n", PACKAGE_STRING);
+ exit(0);
+ }
if (!strcmp("-def", argv[i]) || !strcmp("-default", argv[i])) {
restore_defaults = 1;
continue;