From 4e49a64191d3b08044d29d32896e15013e5e7540 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 19 Jul 2013 19:51:09 -0700 Subject: Add -version flag to print package version string from autoconf Also adds missing entry for -help flag to usage message. Signed-off-by: Alan Coopersmith Reviewed-By: Matt Dew --- man/xrdb.man | 4 ++++ xrdb.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/man/xrdb.man b/man/xrdb.man index 7f0ccf1..211c0a2 100644 --- a/man/xrdb.man +++ b/man/xrdb.man @@ -168,6 +168,10 @@ program accepts the following options: This option (or any unsupported option) will cause a brief description of the allowable options and parameters to be printed. .TP 8 +.B \-version +This option will cause the xrdb version to be printed and the program to exit +without performing any other operations. +.TP 8 .B \-display \fIdisplay\fP This option specifies the X server to be used; see \fIX(__miscmansuffix__)\fP. It also specifies the screen to use for the \fI-screen\fP option, diff --git a/xrdb.c b/xrdb.c index 58dd049..24a6aa5 100644 --- a/xrdb.c +++ b/xrdb.c @@ -738,6 +738,8 @@ Syntax (void) fprintf (stderr, "usage: %s [-options ...] [filename]\n\n" "where options include:\n" + " -help print this help message\n" + " -version print the program version\n" " -display host:dpy display to use\n" " -all do all resources [default]\n" " -global do screen-independent resources\n" @@ -898,6 +900,9 @@ main(int argc, char *argv[]) } else if (isabbreviation ("-help", arg, 2)) { Syntax (); /* doesn't return */ + } else if (isabbreviation ("-version", arg, 2)) { + printf("%s\n", PACKAGE_STRING); + exit(0); } else if (isabbreviation ("-display", arg, 2)) { if (++i >= argc) Syntax (); displayname = argv[i]; -- cgit v1.2.3