main: Add --dbus-debug command line parameter

This commit is contained in:
Denis Kenzior 2014-11-07 21:43:18 -06:00
parent 4dc24025a4
commit 333b28bf3a
1 changed files with 10 additions and 4 deletions

View File

@ -52,20 +52,23 @@ static void usage(void)
"Usage:\n"); "Usage:\n");
printf("\tiwd [options]\n"); printf("\tiwd [options]\n");
printf("Options:\n" printf("Options:\n"
"\t-B, --dbus-debug Enable DBus debugging\n"
"\t-K, --kdbus Setup Kernel D-Bus\n" "\t-K, --kdbus Setup Kernel D-Bus\n"
"\t-h, --help Show help options\n"); "\t-h, --help Show help options\n");
} }
static const struct option main_options[] = { static const struct option main_options[] = {
{ "kdbus", no_argument, NULL, 'K' }, { "kdbus", no_argument, NULL, 'K' },
{ "version", no_argument, NULL, 'v' }, { "dbus-debug", no_argument, NULL, 'B' },
{ "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
{ } { }
}; };
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
bool enable_kdbus = false; bool enable_kdbus = false;
bool enable_dbus_debug = false;
struct l_signal *signal; struct l_signal *signal;
sigset_t mask; sigset_t mask;
int exit_status; int exit_status;
@ -81,6 +84,9 @@ int main(int argc, char *argv[])
case 'K': case 'K':
enable_kdbus = true; enable_kdbus = true;
break; break;
case 'B':
enable_dbus_debug = true;
break;
case 'v': case 'v':
printf("%s\n", VERSION); printf("%s\n", VERSION);
return EXIT_SUCCESS; return EXIT_SUCCESS;
@ -135,7 +141,7 @@ int main(int argc, char *argv[])
} }
} }
if (!dbus_init()) { if (!dbus_init(enable_dbus_debug)) {
exit_status = EXIT_FAILURE; exit_status = EXIT_FAILURE;
goto destroy; goto destroy;
} }