diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-19 00:45:13 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-19 00:45:13 -0700 |
commit | a67a804a43ad75efb3040c9e9e067fc60cde1256 (patch) | |
tree | 71862043b20177a3f3c12f8bea181369547c1cd8 | |
parent | 81a64c9112b9d650106a01d8bcd246011d037bc2 (diff) |
Add -version flag to print version from PACKAGE_STRING
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | man/xlsclients.man | 5 | ||||
-rw-r--r-- | 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++) { |