From a67a804a43ad75efb3040c9e9e067fc60cde1256 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 19 Jul 2013 00:45:13 -0700 Subject: Add -version flag to print version from PACKAGE_STRING Signed-off-by: Alan Coopersmith --- man/xlsclients.man | 5 ++++- xlsclients.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/man/xlsclients.man b/man/xlsclients.man index 552907f..6667837 100644 --- a/man/xlsclients.man +++ b/man/xlsclients.man @@ -27,7 +27,7 @@ xlsclients - list client applications running on a display .SH SYNOPSIS .B "xlsclients" -[-display \fIdisplayname\fP] [-a] [-l] [-m maxcmdlen] +[-display \fIdisplayname\fP] [-a] [-l] [-m maxcmdlen] [-version] .SH DESCRIPTION .PP .I Xlsclients @@ -51,6 +51,9 @@ the default format. .B \-m \fImaxcmdlen\fP This option specifies the maximum number of characters in a command to print out. The default is 10000. +.TP 8 +.B \-version +Print the program version and exit. .SH ENVIRONMENT .PP .TP 8 diff --git a/xlsclients.c b/xlsclients.c index 5b7ccad..4574010 100644 --- a/xlsclients.c +++ b/xlsclients.c @@ -68,7 +68,8 @@ static void usage(void) { fprintf (stderr, - "usage: %s [-display dpy] [-m len] [-[a][l]]\n", ProgramName); + "usage: %s [-display dpy] [-m len] [-[a][l]] [-version]\n", + ProgramName); exit (1); } @@ -168,6 +169,9 @@ main(int argc, char *argv[]) if (++i >= argc) usage (); maxcmdlen = atoi (argv[i]); continue; + case 'v': /* -version */ + printf("%s\n", PACKAGE_STRING); + exit(0); } for (cp = &arg[1]; *cp; cp++) { -- cgit v1.2.3