#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <syslog.h>
#include <signal.h>
#include <getopt.h>
#include <sys/stat.h>
static struct option options[] = {
{ "nodaemon", 0, 0, 'n' },
{ "compat", 0, 0, 'c' },
+ { "debug", 0, 0, 'd' },
{ "help", 0, 0, 'h' },
{ }
};
DBusConnection *conn;
DBusError err;
struct sigaction sa;
- int log_option = LOG_NDELAY | LOG_PID;
- int opt, detach = 1, compat = 0;
+ int opt, detach = 1, compat = 0, debug = 0;
- while ((opt = getopt_long(argc, argv, "+nch", options, NULL)) != EOF) {
- switch(opt) {
+ while ((opt = getopt_long(argc, argv, "+ncdh", options, NULL)) != EOF) {
+ switch (opt) {
case 'n':
detach = 0;
break;
case 'c':
compat = 1;
break;
+ case 'd':
+ debug = 1;
+ break;
case 'h':
default:
usage();
perror("Can't start daemon");
exit(1);
}
- } else
- log_option |= LOG_PERROR;
-
- openlog("connmand", log_option, LOG_DAEMON);
+ }
mkdir(STATEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
compat = 0;
}
+ __connman_log_init(detach, debug);
+
__connman_agent_init(conn);
__connman_manager_init(conn, compat);
__connman_agent_cleanup();
+ __connman_log_cleanup();
+
g_dbus_cleanup_connection(conn);
g_main_loop_unref(main_loop);
rmdir(STATEDIR);
- closelog();
-
return 0;
}