main: Add command line options for white/black list
--interfaces (-i) tells iwd which interfaces to manage. If the option is ommitted, all interfaces will be managed. --nointerfaces (-I) tells iwd which interfaces to blacklist. If the option is ommitted, no interfaces will be blacklisted.
This commit is contained in:
parent
cda2026b23
commit
04de3af41f
22
src/main.c
22
src/main.c
|
@ -45,6 +45,8 @@
|
||||||
#include "src/backtrace.h"
|
#include "src/backtrace.h"
|
||||||
|
|
||||||
static struct l_timeout *timeout = NULL;
|
static struct l_timeout *timeout = NULL;
|
||||||
|
static const char *interfaces;
|
||||||
|
static const char *nointerfaces;
|
||||||
|
|
||||||
static void main_loop_quit(struct l_timeout *timeout, void *user_data)
|
static void main_loop_quit(struct l_timeout *timeout, void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -74,14 +76,18 @@ static void usage(void)
|
||||||
printf("Options:\n"
|
printf("Options:\n"
|
||||||
"\t-B, --dbus-debug Enable DBus debugging\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-i, --interfaces Interfaces to manage\n"
|
||||||
|
"\t-I, --nointerfaces Interfaces to ignore\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' },
|
||||||
{ "dbus-debug", no_argument, NULL, 'B' },
|
{ "dbus-debug", no_argument, NULL, 'B' },
|
||||||
{ "version", no_argument, NULL, 'v' },
|
{ "version", no_argument, NULL, 'v' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "interfaces", required_argument, NULL, 'i' },
|
||||||
|
{ "nointerfaces", required_argument, NULL, 'I' },
|
||||||
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,7 +140,7 @@ int main(int argc, char *argv[])
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
opt = getopt_long(argc, argv, "KBvh", main_options, NULL);
|
opt = getopt_long(argc, argv, "KBi:I:vh", main_options, NULL);
|
||||||
if (opt < 0)
|
if (opt < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -145,6 +151,12 @@ int main(int argc, char *argv[])
|
||||||
case 'B':
|
case 'B':
|
||||||
enable_dbus_debug = true;
|
enable_dbus_debug = true;
|
||||||
break;
|
break;
|
||||||
|
case 'i':
|
||||||
|
interfaces = optarg;
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
nointerfaces = optarg;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("%s\n", VERSION);
|
printf("%s\n", VERSION);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue