From mboxrd@z Thu Jan 1 00:00:00 1970 From: wallinux@gmail.com (Anders Wallin) Date: Sat, 15 Oct 2016 08:38:23 +0200 Subject: [lttng-dev] [PATCH lttng-tools] Add version info to lttng-relayd help Message-ID: <20161015063823.16638-1-wallinux@gmail.com> lttng-relayd man pages states that the option -V --version is available, but it it's missing in the code Signed-off-by: Anders Wallin --- src/bin/lttng-relayd/main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index ea46ec7..34a9ba1 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -161,10 +161,20 @@ static struct option long_options[] = { { "output", 1, 0, 'o', }, { "verbose", 0, 0, 'v', }, { "config", 1, 0, 'f' }, + { "version", 0, 0, 'V' }, { NULL, 0, 0, 0, }, }; -static const char *config_ignore_options[] = { "help", "config" }; +static const char *config_ignore_options[] = { "help", "config", "version" }; + +/* + * Version info on stderr + */ +static void version(void) +{ + fprintf(stderr, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME "\n", + progname); +} /* * Take an option from the getopt output and set it in the right variable to be @@ -255,6 +265,9 @@ static int set_option(int opt, const char *arg, const char *optname) perror("exec"); } exit(EXIT_FAILURE); + case 'V': + version(); + exit(EXIT_FAILURE); case 'o': if (lttng_is_setuid_setgid()) { WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.", -- 2.10.0