daemon option '--version' added.
This commit is contained in:
+15
-3
@@ -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 <csignal>
|
||||
#include <iostream>
|
||||
|
||||
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<bool>("p_version") == true) {
|
||||
std::cerr << PACKAGE_STRING << std::endl;
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
// print help
|
||||
if (A.getParam<bool>("p_help") == true) {
|
||||
A.printArgs();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
// print Daemon settings
|
||||
// print daemon settings
|
||||
if (A.getParam<bool>("p_settings") == true)
|
||||
A.printSettings();
|
||||
|
||||
// make me Daemon
|
||||
// make me daemon
|
||||
if (A.getParam<bool>("p_foreground") == true) {
|
||||
L += new LogConsole(calcAreas(A.getParam<const char*>("p_logareas")),
|
||||
calcLevel(A.getParam<const char*>("p_loglevel")),
|
||||
|
||||
@@ -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 <string>
|
||||
#include <cstring>
|
||||
@@ -109,4 +109,4 @@ private:
|
||||
void addParam(const char* name, const std::string arg, Datatype datatype);
|
||||
};
|
||||
|
||||
#endif // LIBCORE_APPL_H_
|
||||
#endif // LIBUTILS_APPL_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_
|
||||
|
||||
@@ -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_
|
||||
|
||||
@@ -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 <unistd.h>
|
||||
#include <fcntl.h>
|
||||
@@ -51,6 +51,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // LIBCORE_NOTIFY_H_
|
||||
#endif // LIBUTILS_NOTIFY_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 <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -84,5 +84,5 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // LIBCORE_TCPSOCKET_H_
|
||||
#endif // LIBUTILS_TCPSOCKET_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 <pthread.h>
|
||||
|
||||
@@ -43,4 +43,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // LIBCORE_THREAD_H_
|
||||
#endif // LIBUTILS_THREAD_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 <list>
|
||||
#include <pthread.h>
|
||||
@@ -96,4 +96,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // LIBCORE_WQUEUE_H_
|
||||
#endif // LIBUTILS_WQUEUE_H_
|
||||
|
||||
Reference in New Issue
Block a user