>From 3658cbadb19f62e4ee6751f20af303977e05b290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= Date: Mon, 29 Aug 2011 14:30:54 +0200 Subject: [PATCH] Added sssd --version option https://fedorahosted.org/sssd/ticket/953 --- configure.ac | 3 +++ src/man/sssd.8.xml | 10 ++++++++++ src/monitor/monitor.c | 12 ++++++++++++ 3 files changed, 25 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index 230afa2..9331316 100644 --- a/configure.ac +++ b/configure.ac @@ -25,6 +25,9 @@ AM_GNU_GETTEXT_VERSION([0.14]) AC_SUBST([PRERELEASE_VERSION], PRERELEASE_VERSION_NUMBER) + +AC_DEFINE([RELEASE_VERSION], "PRERELEASE_VERSION_NUMBER", + [Release number of package]) AM_CONDITIONAL([GIT_CHECKOUT], [git log -1 &>/dev/null]) diff --git a/src/man/sssd.8.xml b/src/man/sssd.8.xml index e4d972c..b663ba4 100644 --- a/src/man/sssd.8.xml +++ b/src/man/sssd.8.xml @@ -114,6 +114,16 @@ + + + + + + + Print version number and exit. + + + diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 4cd1e99..a326130 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -2353,6 +2353,7 @@ int main(int argc, const char *argv[]) poptContext pc; int opt_daemon = 0; int opt_interactive = 0; + int opt_version = 0; char *opt_config_file = NULL; char *config_file = NULL; int flags = 0; @@ -2371,6 +2372,8 @@ int main(int argc, const char *argv[]) _("Run interactive (not a daemon)"), NULL}, \ {"config", 'c', POPT_ARG_STRING, &opt_config_file, 0, \ _("Specify a non-default config file"), NULL}, \ + {"version", '\0', POPT_ARG_NONE, &opt_version, 0, \ + _("Prints version number"), NULL }, \ POPT_TABLEEND }; @@ -2390,6 +2393,15 @@ int main(int argc, const char *argv[]) CONVERT_AND_SET_DEBUG_LEVEL(debug_level); + if (opt_version) { + if (strlen(RELEASE_VERSION)) { + puts(VERSION"-0"RELEASE_VERSION); + } else { + puts(VERSION); + } + return EXIT_SUCCESS; + } + /* If the level or timestamps was passed at the command-line, we want * to save it and pass it to the children later. */ -- 1.7.6