summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-01 21:00:47 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-01 21:00:47 -0700
commit5f369174777783fb9544b81cfdfab255d7e990a8 (patch)
treea9fa3ae75446c5e65e6bfab8986d3eca88344ffa
parent007a72af45ea48e3ed5e750b4b39e034b102d2c0 (diff)
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xpr.c13
-rw-r--r--xpr.man4
2 files changed, 17 insertions, 0 deletions
diff --git a/xpr.c b/xpr.c
index 6ab5989..07a8a30 100644
--- a/xpr.c
+++ b/xpr.c
@@ -71,6 +71,10 @@ from the X Consortium.
*
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
#include <X11/Xlib.h>
@@ -511,6 +515,7 @@ usage(void)
" -scale <scale>\n"
" -slide\n"
" -split <n-pages>\n"
+ " -version\n"
);
exit(EXIT_FAILURE);
}
@@ -772,6 +777,14 @@ void parse_args(
unknown_arg(arg);
break;
+ case 'v': /* -version */
+ if (strcmp(*argv, "-version") == 0) {
+ puts(PACKAGE_STRING);
+ exit(0);
+ } else
+ unknown_arg(arg);
+ break;
+
case 'w': /* -width <inches> */
if (!bcmp(*argv, "-width", len)) {
argc--; argv++;
diff --git a/xpr.man b/xpr.man
index 35f78b2..51c78e4 100644
--- a/xpr.man
+++ b/xpr.man
@@ -70,6 +70,8 @@ xpr \- print an X window dump
] [
.B \-slide
] [
+.B \-version
+] [
.I filename
]
.SH DESCRIPTION
@@ -207,6 +209,8 @@ are available.
.IP "\fB\-slide\fP"
This option allows overhead transparencies to be printed
using the PaintJet and PaintJet XL printers.
+.IP "\fB\-version\fP"
+This option prints the program version information and exits.
.SH SEE ALSO
xwd(1), xwud(1), X(1)