[PATCH:fslsfonts 04/17] Add -version option to print version

Alan Coopersmith alan.coopersmith at oracle.com
Fri Nov 15 18:38:33 PST 2013


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 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 <X11/fonts/FSlib.h>
 #include <stdio.h>
 #include <X11/Xos.h>
@@ -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
-- 
1.7.9.2



More information about the xorg-devel mailing list