summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-23 00:29:22 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-23 09:46:25 -0800
commit68eed1b5a1b3cfc5dedc10931c9a6b28b9c66207 (patch)
tree9aa4d7497b3e2b777e3f87d1828592b48b7b35ec
parent19a9941f9a16ae7529ef47bba193eee9ab7db98c (diff)
Add -version flag to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/showfont.man3
-rw-r--r--showfont.c12
2 files changed, 13 insertions, 2 deletions
diff --git a/man/showfont.man b/man/showfont.man
index 47d077c..d513bdd 100644
--- a/man/showfont.man
+++ b/man/showfont.man
@@ -73,6 +73,9 @@ where 0 is ImageRectMin, 1 is ImageRectMaxWidth and 2 is ImageRectMax).
.TP 8
.B \-noprops
Do not show the font properties.
+.TP 8
+.B \-version
+Print the program version and exit.
.SH "SEE ALSO"
xfs(__appmansuffix__), fslsfonts(__appmansuffix__),
fstobdf(__appmansuffix__), xlsfonts(__appmansuffix__), X(__miscmansuffix__).
diff --git a/showfont.c b/showfont.c
index cef5f1d..21b665d 100644
--- a/showfont.c
+++ b/showfont.c
@@ -49,6 +49,10 @@ from the X Consortium.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -354,8 +358,9 @@ usage(const char *msg)
fprintf(stderr,
"Usage: %s [-server servername] [-extents_only] [-noprops]\n"
" [-lsb] [-msb] [-LSB] [-MSB] [-unit #] [-pad #] [-bitmap_pad value]\n"
- " [-start first_char] [-end last_char] -fn fontname\n",
- ProgramName);
+ " [-start first_char] [-end last_char] -fn fontname\n"
+ " or: %s -version\n",
+ ProgramName, ProgramName);
exit(1);
}
@@ -424,6 +429,9 @@ main(int argc, char **argv)
fontname = argv[i];
else
usage("-fn requires an argument");
+ } else if (!strcmp(argv[i], "-version")) {
+ puts(PACKAGE_STRING);
+ exit(0);
} else {
char msg[128];
snprintf(msg, sizeof(msg), "unrecognized argument: %s", argv[i]);