diff --git a/src/ebusd/ebusd.cpp b/src/ebusd/ebusd.cpp index 6aa90d8c..1e5def66 100644 --- a/src/ebusd/ebusd.cpp +++ b/src/ebusd/ebusd.cpp @@ -17,11 +17,13 @@ * along with ebusd. If not, see http://www.gnu.org/licenses/. */ +#include "config.h" #include "logger.h" #include "daemon.h" #include "appl.h" #include "baseloop.h" #include +#include using namespace libebus; @@ -119,6 +121,10 @@ void define_args() "\tprint daemon settings\n", Appl::type_bool, Appl::opt_none); + A.addItem("p_version", Appl::Param(false), "v", "version", + "\tprint ebusd version\n", + Appl::type_bool, Appl::opt_none); + A.addItem("p_help", Appl::Param(false), "h", "help", "\tprint this message", Appl::type_bool, Appl::opt_none); @@ -177,17 +183,23 @@ int main(int argc, char* argv[]) exit(EXIT_FAILURE); } - // print Help + // print version + if (A.getParam("p_version") == true) { + std::cerr << PACKAGE_STRING << std::endl; + exit(EXIT_SUCCESS); + } + + // print help if (A.getParam("p_help") == true) { A.printArgs(); exit(EXIT_SUCCESS); } - // print Daemon settings + // print daemon settings if (A.getParam("p_settings") == true) A.printSettings(); - // make me Daemon + // make me daemon if (A.getParam("p_foreground") == true) { L += new LogConsole(calcAreas(A.getParam("p_logareas")), calcLevel(A.getParam("p_loglevel")), diff --git a/src/lib/utils/appl.h b/src/lib/utils/appl.h index d9684644..392d947d 100644 --- a/src/lib/utils/appl.h +++ b/src/lib/utils/appl.h @@ -17,8 +17,8 @@ * along with ebusd. If not, see http://www.gnu.org/licenses/. */ -#ifndef LIBCORE_APPL_H_ -#define LIBCORE_APPL_H_ +#ifndef LIBUTILS_APPL_H_ +#define LIBUTILS_APPL_H_ #include #include @@ -109,4 +109,4 @@ private: void addParam(const char* name, const std::string arg, Datatype datatype); }; -#endif // LIBCORE_APPL_H_ +#endif // LIBUTILS_APPL_H_ diff --git a/src/lib/utils/daemon.h b/src/lib/utils/daemon.h index 37ac41b3..ac01d42b 100644 --- a/src/lib/utils/daemon.h +++ b/src/lib/utils/daemon.h @@ -17,8 +17,8 @@ * along with ebusd. If not, see http://www.gnu.org/licenses/. */ -#ifndef LIBCORE_DAEMON_H_ -#define LIBCORE_DAEMON_H_ +#ifndef LIBUTILS_DAEMON_H_ +#define LIBUTILS_DAEMON_H_ class Daemon { @@ -45,4 +45,4 @@ private: }; -#endif // LIBCORE_DAEMON_H_ +#endif // LIBUTILS_DAEMON_H_ diff --git a/src/lib/utils/logger.h b/src/lib/utils/logger.h index d704e2c1..e91261b8 100644 --- a/src/lib/utils/logger.h +++ b/src/lib/utils/logger.h @@ -17,8 +17,8 @@ * along with ebusd. If not, see http://www.gnu.org/licenses/. */ -#ifndef LIBCORE_LOGGER_H_ -#define LIBCORE_LOGGER_H_ +#ifndef LIBUTILS_LOGGER_H_ +#define LIBUTILS_LOGGER_H_ #include "wqueue.h" #include "thread.h" @@ -178,4 +178,4 @@ private: }; -#endif // LIBCORE_LOGGER_H_ +#endif // LIBUTILS_LOGGER_H_ diff --git a/src/lib/utils/notify.h b/src/lib/utils/notify.h index 91909662..accc6339 100644 --- a/src/lib/utils/notify.h +++ b/src/lib/utils/notify.h @@ -17,8 +17,8 @@ * along with ebusd. If not, see http://www.gnu.org/licenses/. */ -#ifndef LIBCORE_NOTIFY_H_ -#define LIBCORE_NOTIFY_H_ +#ifndef LIBUTILS_NOTIFY_H_ +#define LIBUTILS_NOTIFY_H_ #include #include @@ -51,6 +51,6 @@ private: }; -#endif // LIBCORE_NOTIFY_H_ +#endif // LIBUTILS_NOTIFY_H_ diff --git a/src/lib/utils/tcpsocket.h b/src/lib/utils/tcpsocket.h index 335cfb64..fa507204 100644 --- a/src/lib/utils/tcpsocket.h +++ b/src/lib/utils/tcpsocket.h @@ -17,8 +17,8 @@ * along with ebusd. If not, see http://www.gnu.org/licenses/. */ -#ifndef LIBCORE_TCPSOCKET_H_ -#define LIBCORE_TCPSOCKET_H_ +#ifndef LIBUTILS_TCPSOCKET_H_ +#define LIBUTILS_TCPSOCKET_H_ #include #include @@ -84,5 +84,5 @@ private: }; -#endif // LIBCORE_TCPSOCKET_H_ +#endif // LIBUTILS_TCPSOCKET_H_ diff --git a/src/lib/utils/thread.h b/src/lib/utils/thread.h index 913735a3..03ecfd0d 100644 --- a/src/lib/utils/thread.h +++ b/src/lib/utils/thread.h @@ -17,8 +17,8 @@ * along with ebusd. If not, see http://www.gnu.org/licenses/. */ -#ifndef LIBCORE_THREAD_H_ -#define LIBCORE_THREAD_H_ +#ifndef LIBUTILS_THREAD_H_ +#define LIBUTILS_THREAD_H_ #include @@ -43,4 +43,4 @@ private: }; -#endif // LIBCORE_THREAD_H_ +#endif // LIBUTILS_THREAD_H_ diff --git a/src/lib/utils/wqueue.h b/src/lib/utils/wqueue.h index 0509b87e..99c4fc48 100644 --- a/src/lib/utils/wqueue.h +++ b/src/lib/utils/wqueue.h @@ -17,8 +17,8 @@ * along with ebusd. If not, see http://www.gnu.org/licenses/. */ -#ifndef LIBCORE_WQUEUE_H_ -#define LIBCORE_WQUEUE_H_ +#ifndef LIBUTILS_WQUEUE_H_ +#define LIBUTILS_WQUEUE_H_ #include #include @@ -96,4 +96,4 @@ private: }; -#endif // LIBCORE_WQUEUE_H_ +#endif // LIBUTILS_WQUEUE_H_