From: Vincent Bernat Date: Fri, 18 May 2012 05:33:47 +0000 (+0200) Subject: Add a `-v` flag to just get version number. X-Git-Tag: 0.6.1~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=96e49a40c6c09a835e18b28d707371ce6dfb542f;p=thirdparty%2Flldpd.git Add a `-v` flag to just get version number. Closes #18. --- diff --git a/man/lldpctl.8 b/man/lldpctl.8 index dac8c054..18191fea 100644 --- a/man/lldpctl.8 +++ b/man/lldpctl.8 @@ -21,8 +21,7 @@ .Nd control LLDP daemon .Sh SYNOPSIS .Nm -.Op Fl d -.Op Fl a +.Op Fl adv .Op Fl L Ar location .Op Fl P Ar policy .Op Fl O Ar poe @@ -45,6 +44,10 @@ The options are as follows: .Bl -tag -width Ds .It Fl d Enable more debugging information. +.It Fl v +Show +.Nm +version. .It Fl a Display all remote ports, including those hidden by the smart filter. .It Fl f Ar format diff --git a/man/lldpd.8 b/man/lldpd.8 index 4cf0ee31..49f14494 100644 --- a/man/lldpd.8 +++ b/man/lldpd.8 @@ -21,7 +21,7 @@ .Nd LLDP daemon .Sh SYNOPSIS .Nm -.Op Fl dxcseiklr +.Op Fl dxcseiklrv .Op Fl S Ar description .Op Fl P Ar platform .Op Fl X Ar socket @@ -175,6 +175,10 @@ transmit sensible information like serial numbers. Filter neighbors. See section .Sx FILTERING NEIGHBORS for details. +.It Fl v +Show +.Nm +version. .El .Sh FILTERING NEIGHBORS In a heterogeneous network, you may see several different hosts on the diff --git a/src/lldpctl.c b/src/lldpctl.c index d4ff8d88..436ac2e8 100644 --- a/src/lldpctl.c +++ b/src/lldpctl.c @@ -33,7 +33,7 @@ extern const char *__progname; # define __progname "lldpctl" #endif -#define LLDPCTL_ARGS "hdaf:L:P:O:o:" +#define LLDPCTL_ARGS "hdvaf:L:P:O:o:" static void usage(void) @@ -717,6 +717,10 @@ main(int argc, char *argv[]) case 'd': debug++; break; + case 'v': + fprintf(stdout, "%s\n", PACKAGE_VERSION); + exit(0); + break; case 'a': hidden = 1; break; diff --git a/src/lldpd.c b/src/lldpd.c index 8595b453..1880c3fb 100644 --- a/src/lldpd.c +++ b/src/lldpd.c @@ -1029,7 +1029,7 @@ lldpd_main(int argc, char *argv[]) char *cidp = NULL; char *interfaces = NULL; char *popt, opts[] = - "H:hkrdxX:m:4:6:I:C:p:M:P:S:i@ "; + "H:vhkrdxX:m:4:6:I:C:p:M:P:S:i@ "; int i, found, advertise_version = 1; #ifdef ENABLE_LLDPMED int lldpmed = 0, noinventory = 0; @@ -1061,6 +1061,10 @@ lldpd_main(int argc, char *argv[]) case 'h': usage(); break; + case 'v': + fprintf(stdout, "%s\n", PACKAGE_VERSION); + exit(0); + break; case 'd': debug++; break;