From 8d60a7198cc366d72fd03a5821de9b56719588fc Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 4 Nov 2013 23:31:29 -0800 Subject: Add -version option to print version Signed-off-by: Alan Coopersmith Reviewed-by: Gaetan Nadon --- fslsfonts.c | 9 +++++++++ man/fslsfonts.man | 3 +++ 2 files changed, 12 insertions(+) diff --git a/fslsfonts.c b/fslsfonts.c index 6ff6a2d..9de741e 100644 --- a/fslsfonts.c +++ b/fslsfonts.c @@ -43,6 +43,10 @@ in this Software without prior written authorization from The Open Group. * THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #include @@ -101,6 +105,7 @@ usage(void) " -w width maximum width for multiple columns\n" " -n columns number of columns if multi column\n" " -server servername font server to contact\n" + " -version print command version and exit\n" "\n"); exit(1); } @@ -120,6 +125,10 @@ main(int argc, char *argv[]) usage(); servername = argv[i]; } + else if (strcmp(argv[i], "-version") == 0) { + printf("%s\n", PACKAGE_STRING); + exit(0); + } } if ((svr = FSOpenServer(servername)) == NULL) { diff --git a/man/fslsfonts.man b/man/fslsfonts.man index 35dd1c3..e5975c5 100644 --- a/man/fslsfonts.man +++ b/man/fslsfonts.man @@ -85,6 +85,9 @@ number of character specified by \fB\-w\fP \fIwidth\fP. .TP 8 .B \-u This option indicates that the output should be left unsorted. +.TP 8 +.B \-version +This option prints the program version and exits. .PP .SH ENVIRONMENT .TP 8 -- cgit v1.2.3