summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2011-08-29 14:30:54 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-12-08 12:02:32 -0500
commitd3da1c165cdb4c1ec126a8f4b6b544ca415b9d20 (patch)
treeb3c0f945ca75e958c1973782ddb6576a727b73aa /src
parent81b69919e1755180280c215468b4368d13024ea5 (diff)
downloadsssd-d3da1c165cdb4c1ec126a8f4b6b544ca415b9d20.tar.gz
sssd-d3da1c165cdb4c1ec126a8f4b6b544ca415b9d20.tar.xz
sssd-d3da1c165cdb4c1ec126a8f4b6b544ca415b9d20.zip
Added sssd --version option
https://fedorahosted.org/sssd/ticket/953
Diffstat (limited to 'src')
-rw-r--r--src/conf_macros.m411
-rw-r--r--src/man/sssd.8.xml10
-rw-r--r--src/monitor/monitor.c12
3 files changed, 31 insertions, 2 deletions
diff --git a/src/conf_macros.m4 b/src/conf_macros.m4
index 45d54841d..fc5dec674 100644
--- a/src/conf_macros.m4
+++ b/src/conf_macros.m4
@@ -1,3 +1,14 @@
+AC_DEFUN([WITH_DISTRO_VERSION],
+ [ AC_ARG_WITH([distro-version],
+ [AC_HELP_STRING([--with-distro-version=VERSION],
+ [Distro version number []]
+ )
+ ]
+ )
+ AC_DEFINE_UNQUOTED(DISTRO_VERSION, "$with_distro_version",
+ [Distro version number])
+ ])
+
AC_DEFUN([WITH_DB_PATH],
[ AC_ARG_WITH([db-path],
[AC_HELP_STRING([--with-db-path=PATH],
diff --git a/src/man/sssd.8.xml b/src/man/sssd.8.xml
index 5fda3ad71..8eba18662 100644
--- a/src/man/sssd.8.xml
+++ b/src/man/sssd.8.xml
@@ -130,6 +130,16 @@
</listitem>
</varlistentry>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="include/param_help.xml" />
+ <varlistentry>
+ <term>
+ <option>--version</option>
+ </term>
+ <listitem>
+ <para>
+ Print version number and exit.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 2db9d5417..a0a0cc2f7 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2386,6 +2386,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;
@@ -2404,6 +2405,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, \
+ _("Print version number and exit"), NULL }, \
POPT_TABLEEND
};
@@ -2423,8 +2426,13 @@ int main(int argc, const char *argv[])
CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
- /* If the level, timestamps or microseconds was passed at the command-line,
- * we want to save it and pass it to the children later.
+ if (opt_version) {
+ puts(VERSION""DISTRO_VERSION""PRERELEASE_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.
*/
cmdline_debug_level = debug_level;
cmdline_debug_timestamps = debug_timestamps;