[icinga-checkins] icinga.org: icinga2/master: Documentation: add man pages

git at icinga.org git at icinga.org
Wed Feb 6 17:49:29 CET 2013


Module: icinga2
Branch: master
Commit: 41e10c83be29b793b04dedad5018d0e9a0fe2287
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=41e10c83be29b793b04dedad5018d0e9a0fe2287

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Feb  6 17:49:11 2013 +0100

Documentation: add man pages

Fixes #2844

---

 autogen.sh            |    6 ++++++
 configure.ac          |    2 ++
 docs/.gitignore       |    2 +-
 docs/Makefile.am      |   11 +++++++++--
 icinga-app/icinga.cpp |   24 +++++++++++++++++-------
 5 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index 896618d..a6b2d4e 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -99,6 +99,12 @@ fi
   NO_AUTOMAKE=yes
 }
 
+(help2man --version) < /dev/null > /dev/null 2>&1 || {
+  echo
+  echo "**Error**: You must have \`html2man' installed."
+  echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
+  DIE=1
+}
 
 # if no automake, don't bother testing for aclocal
 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
diff --git a/configure.ac b/configure.ac
index 5fcce55..277d52b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,6 +46,8 @@ DX_PDF_FEATURE(OFF)
 DX_PS_FEATURE(OFF)
 DX_INIT_DOXYGEN([icinga], [docs/Doxyfile], [docs/dev])
 
+AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
+
 AC_PROG_INSTALL
 AC_PROG_LEX
 AC_PROG_YACC
diff --git a/docs/.gitignore b/docs/.gitignore
index ea1f645..62c58f0 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -2,4 +2,4 @@ Doxyfile
 icinga2-intro.html
 icinga2-config.html
 icinga2-config.xml
-
+icinga2.8
diff --git a/docs/Makefile.am b/docs/Makefile.am
index ee4e075..01e30ec 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -2,17 +2,24 @@
 
 EXTRA_DIST = \
 	icinga2-config.txt \
-	icinga2-intro.txt
+	icinga2-intro.txt \
+	icinga2.8
 
 icinga2docdir = ${docdir}
 icinga2doc_DATA = \
 	icinga2-config.html \
 	icinga2-intro.html
 
+man1_MANS = \
+	icinga2.8
+
 .SUFFIXES = .html .txt
 
 .txt.html:
 	asciidoc -a toc -a numbered $<
 
-clean:
+icinga2.8: $(top_srcdir)/icinga-app/icinga2
+	-$(HELP2MAN) --name='The Icinga 2 networking monitoring daemon.' --section=8 --no-info --output=$@ $(top_srcdir)/icinga-app/icinga2
+
+distclean:
 	rm -f $(icinga2doc_DATA)
diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp
index b12f8a1..f6b66bd 100644
--- a/icinga-app/icinga.cpp
+++ b/icinga-app/icinga.cpp
@@ -186,15 +186,25 @@ int main(int argc, char **argv)
 		Application::SetDebugging(true);
 
 	if (g_AppParams.count("help") || g_AppParams.count("version")) {
-		std::cout << "Icinga application loader"
+		String appName = Utility::BaseName(argv[0]);
+
+		if (appName.GetLength() > 3 && appName.SubStr(0, 3) == "lt-")
+			appName = appName.SubStr(3, appName.GetLength() - 3);
+
+		std::cout << appName << " " << "- The Icinga 2 networking monitoring daemon.";
+
+		if (g_AppParams.count("version")) {
 #ifndef _WIN32
-			  << " (version: " << ICINGA_VERSION << ")"
+			std::cout  << " (Version: " << ICINGA_VERSION << ")";
 #endif /* _WIN32 */
-			  << std::endl
-			  << "Copyright (c) 2012-2013 Icinga Development Team (http://www.icinga.org)" << std::endl
-			  << "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>" << std::endl
-			  << "This is free software: you are free to change and redistribute it." << std::endl
-			  << "There is NO WARRANTY, to the extent permitted by law." << std::endl;
+			std::cout << std::endl
+				  << "Copyright (c) 2012-2013 Icinga Development Team (http://www.icinga.org)" << std::endl
+				  << "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>" << std::endl
+				  << "This is free software: you are free to change and redistribute it." << std::endl
+				  << "There is NO WARRANTY, to the extent permitted by law.";
+		}
+
+		std::cout << std::endl;
 
 		if (g_AppParams.count("version"))
 			return EXIT_SUCCESS;





More information about the icinga-checkins mailing list