summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-03 23:48:55 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-03 23:48:55 -0700
commit6f6b4928f0b7de02cb67e5151199976b6c01a8be (patch)
treed669900671eb562704a11ce03e6a67af5b21d93a
parent5ee8bcb7134d049abf50a34fcfd7a9d5e99ba323 (diff)
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xwd.man8
-rw-r--r--xwd.c6
2 files changed, 12 insertions, 2 deletions
diff --git a/man/xwd.man b/man/xwd.man
index 4dc9041..1c1dab6 100644
--- a/man/xwd.man
+++ b/man/xwd.man
@@ -29,7 +29,7 @@ xwd - dump an image of an X window
.B "xwd"
[-debug] [-help] [-nobdrs] [-out \fIfile\fP] [-xy] [-frame] [-add \fIvalue\fP]
[-root | -id \fIid\fP | -name \fIname\fP ] [-icmap] [-screen] [-silent]
-[-display \fIdisplay\fP]
+[-display \fIdisplay\fP] [-version]
.SH DESCRIPTION
.PP
.I Xwd
@@ -112,6 +112,12 @@ popups that are independent windows but appear over the specified window.
.B "-silent"
Operate silently, i.e. don't ring any bells before and after dumping
the window.
+.PP
+.TP 8
+.B "-version"
+This option indicates that
+.I xwd
+should print its version information and exit.
.SH ENVIRONMENT
.PP
.TP 8
diff --git a/xwd.c b/xwd.c
index d446bd5..c3a053b 100644
--- a/xwd.c
+++ b/xwd.c
@@ -196,6 +196,10 @@ main(int argc, char **argv)
silent = True;
continue;
}
+ if (!strcmp(argv[i], "-version")) {
+ puts(PACKAGE_STRING);
+ exit(0);
+ }
fprintf (stderr, "%s: unrecognized argument '%s'\n",
program_name, argv[i]);
usage(NULL);
@@ -528,7 +532,7 @@ usage(const char *errmsg)
fprintf (stderr,
"usage: %s [-display host:dpy] [-debug] [-help] %s [-nobdrs] [-out <file>]",
program_name, "[{-root|-id <id>|-name <name>}]");
- fprintf (stderr, " [-xy] [-add value] [-frame]\n");
+ fprintf (stderr, " [-xy] [-add value] [-frame] [-version]\n");
exit(1);
}