diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-06-04 16:24:18 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-06-04 16:24:18 -0700 |
commit | 21180fe24c4386d41067725bcf0a8f48d1741393 (patch) | |
tree | 0975febc11ce1e54576a820c3367d754810d75e2 | |
parent | 9a9e7cb288419ab56935f5a99577e323a0e60b9b (diff) |
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | man/xwud.man | 8 | ||||
-rw-r--r-- | xwud.c | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/man/xwud.man b/man/xwud.man index 0ca7d95..fa2bd1d 100644 --- a/man/xwud.man +++ b/man/xwud.man @@ -30,7 +30,7 @@ xwud - image displayer for X [\-in \fIfile\fP] [\-noclick] [\-geometry \fIgeom\fP] [\-display \fIdisplay\fP] [\-new] [\-std <maptype>] [\-raw] [\-vis <vis-type-or-id>] [\-scale] [\-help] [\-rv] [\-plane \fInumber\fP] [\-fg \fIcolor\fP] [\-bg \fIcolor\fP] -[\-dumpheader] +[\-dumpheader] [\-version] .SH DESCRIPTION .PP .I Xwud @@ -122,6 +122,12 @@ Typical types are "best", "default", and "gray". See \fIxstdcmap(__appmansuffix for one way of creating Standard Colormaps. .PP .TP 8 +.B "\-version" +This option causes +.I xwd +to print its version information and exit. +.PP +.TP 8 .B "\-vis \fIvis-type-or-id\fP" This option allows you to specify a particular visual or visual class. The default is to pick the "best" one. A particular class can be @@ -28,6 +28,9 @@ from The Open Group. /* xwud - marginally useful raster image undumper */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <X11/Xos.h> #include <X11/Xlib.h> @@ -85,7 +88,7 @@ usage(const char *errmsg) " [-in <file>] [-noclick] [-geometry <geom>] [-display <display>]\n" " [-new] [-std <maptype>] [-raw] [-vis <vis-type-or-id>]\n" " [-help] [-rv] [-plane <number>] [-fg <color>] [-bg <color>]\n" - " [-scale]\n" + " [-scale] [-dumpheader] [-version]\n" ); exit(1); } @@ -236,6 +239,10 @@ main(int argc, char *argv[]) vis = argv[i]; continue; } + if (strcmp(argv[i], "-version") == 0) { + puts(PACKAGE_STRING); + exit(0); + } fprintf (stderr, "%s: unrecognized argument '%s'\n\n", progname, argv[i]); usage(NULL); |