[Libreoffice-commits] online.git: loolwsd/configure.ac loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp
Pranav Kant
pranavk at libreoffice.org
Tue Jan 19 08:36:24 PST 2016
loolwsd/LOOLWSD.cpp | 14 ++++++++++++++
loolwsd/LOOLWSD.hpp | 1 +
loolwsd/configure.ac | 12 ++++++++++++
3 files changed, 27 insertions(+)
New commits:
commit f429001ff9ed1a903b6687b8798fa8d8698c7adb
Author: Pranav Kant <pranavk at libreoffice.org>
Date: Sun Dec 20 00:08:44 2015 +0530
loolwsd: Display version information on command line
Change-Id: Ie65c30574ca4cef619a224ec6df3501d6bda086a
Reviewed-on: https://gerrit.libreoffice.org/20847
Reviewed-by: jan iversen <jani at documentfoundation.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 78fcc7c..f629d8e 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -718,6 +718,10 @@ void LOOLWSD::defineOptions(OptionSet& optionSet)
.required(false)
.repeatable(false));
+ optionSet.addOption(Option("version", "", "Display version information.")
+ .required(false)
+ .repeatable(false));
+
optionSet.addOption(Option("port", "", "Port number to listen to (default: " + std::to_string(DEFAULT_CLIENT_PORT_NUMBER) + "),"
" must not be " + std::to_string(MASTER_PORT_NUMBER) + ".")
.required(false)
@@ -775,6 +779,11 @@ void LOOLWSD::handleOption(const std::string& optionName, const std::string& val
displayHelp();
exit(Application::EXIT_OK);
}
+ else if (optionName == "version")
+ {
+ displayVersion();
+ exit(Application::EXIT_OK);
+ }
else if (optionName == "port")
ClientPortNumber = std::stoi(value);
else if (optionName == "cache")
@@ -806,6 +815,11 @@ void LOOLWSD::displayHelp()
helpFormatter.format(std::cout);
}
+void LOOLWSD::displayVersion()
+{
+ std::cout << LOOLWSD_VERSION << std::endl;
+}
+
bool LOOLWSD::createBroker(const std::string& rJailId)
{
Process::Args args;
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index e29f6bd..0e8e798 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -184,6 +184,7 @@ protected:
private:
void displayHelp();
+ void displayVersion();
void componentMain();
void desktopMain();
void startupComponent(int nComponents);
diff --git a/loolwsd/configure.ac b/loolwsd/configure.ac
index de10fd0..1201c93 100644
--- a/loolwsd/configure.ac
+++ b/loolwsd/configure.ac
@@ -7,6 +7,18 @@ AC_INIT([loolwsd], [1.5.0], [libreoffice at lists.freedesktop.org])
AM_INIT_AUTOMAKE([1.11 silent-rules subdir-objects])
+LOOLWSD_VERSION_MAJOR=`echo $VERSION | awk -F. '{print $1}'`
+LOOLWSD_VERSION_MINOR=`echo $VERSION | awk -F. '{print $2}'`
+LOOLWSD_VERSION_MICRO=`echo $VERSION | awk -F. '{print $3}'`
+LOOLWSD_VERSION="$LOOLWSD_VERSION_MAJOR.$LOOLWSD_VERSION_MINOR.$LOOLWSD_VERSION_MICRO"
+
+AC_SUBST([LOOLWSD_VERSION_MAJOR])
+AC_SUBST([LOOLWSD_VERSION_MINOR])
+AC_SUBST([LOOLWSD_VERSION_MICRO])
+AC_SUBST([LOOLWSD_VERSION])
+
+AC_DEFINE_UNQUOTED([LOOLWSD_VERSION],[["$LOOLWSD_VERSION"]],[LibreOffice On-Line WebSocket server version])
+
AC_CONFIG_SRCDIR([LOOLWSD.cpp])
AC_CONFIG_HEADERS([config.h])
More information about the Libreoffice-commits
mailing list