diff options
| -rw-r--r-- | src/main.c | 22 |
1 files changed, 21 insertions, 1 deletions
| @@ -357,8 +357,12 @@ static void usage() | |||
| 357 | printf(" \tStarting another instance will trigger discovery instead.\n"); | 357 | printf(" \tStarting another instance will trigger discovery instead.\n"); |
| 358 | printf(" -z, --enable-exit\tEnable \"--exit\" request from other instances and exit\n"); | 358 | printf(" -z, --enable-exit\tEnable \"--exit\" request from other instances and exit\n"); |
| 359 | printf(" \tautomatically if no device is attached.\n"); | 359 | printf(" \tautomatically if no device is attached.\n"); |
| 360 | #ifdef HAVE_UDEV | ||
| 360 | printf(" -u, --udev\t\tRun in udev operation mode (implies -n and -z).\n"); | 361 | printf(" -u, --udev\t\tRun in udev operation mode (implies -n and -z).\n"); |
| 362 | #endif | ||
| 363 | #ifdef HAVE_SYSTEMD | ||
| 361 | printf(" -s, --systemd\t\tRun in systemd operation mode (implies -z and -f).\n"); | 364 | printf(" -s, --systemd\t\tRun in systemd operation mode (implies -z and -f).\n"); |
| 365 | #endif | ||
| 362 | printf(" -x, --exit\t\tNotify a running instance to exit if there are no devices\n"); | 366 | printf(" -x, --exit\t\tNotify a running instance to exit if there are no devices\n"); |
| 363 | printf(" \t\tconnected (sends SIGUSR1 to running instance) and exit.\n"); | 367 | printf(" \t\tconnected (sends SIGUSR1 to running instance) and exit.\n"); |
| 364 | printf(" -X, --force-exit\tNotify a running instance to exit even if there are still\n"); | 368 | printf(" -X, --force-exit\tNotify a running instance to exit even if there are still\n"); |
| @@ -376,8 +380,12 @@ static void parse_opts(int argc, char **argv) | |||
| 376 | {"user", 1, NULL, 'U'}, | 380 | {"user", 1, NULL, 'U'}, |
| 377 | {"disable-hotplug", 0, NULL, 'n'}, | 381 | {"disable-hotplug", 0, NULL, 'n'}, |
| 378 | {"enable-exit", 0, NULL, 'z'}, | 382 | {"enable-exit", 0, NULL, 'z'}, |
| 383 | #ifdef HAVE_UDEV | ||
| 379 | {"udev", 0, NULL, 'u'}, | 384 | {"udev", 0, NULL, 'u'}, |
| 385 | #endif | ||
| 386 | #ifdef HAVE_SYSTEMD | ||
| 380 | {"systemd", 0, NULL, 's'}, | 387 | {"systemd", 0, NULL, 's'}, |
| 388 | #endif | ||
| 381 | {"exit", 0, NULL, 'x'}, | 389 | {"exit", 0, NULL, 'x'}, |
| 382 | {"force-exit", 0, NULL, 'X'}, | 390 | {"force-exit", 0, NULL, 'X'}, |
| 383 | {"version", 0, NULL, 'V'}, | 391 | {"version", 0, NULL, 'V'}, |
| @@ -385,8 +393,16 @@ static void parse_opts(int argc, char **argv) | |||
| 385 | }; | 393 | }; |
| 386 | int c; | 394 | int c; |
| 387 | 395 | ||
| 396 | #ifdef HAVE_SYSTEMD | ||
| 397 | const char* opts_spec = "hfvVuU:xXsnz"; | ||
| 398 | #elif HAVE_UDEV | ||
| 399 | const char* opts_spec = "hfvVuU:xXnz"; | ||
| 400 | #else | ||
| 401 | const char* opts_spec = "hfvVU:xXnz"; | ||
| 402 | #endif | ||
| 403 | |||
| 388 | while (1) { | 404 | while (1) { |
| 389 | c = getopt_long(argc, argv, "hfvVuU:xXsnz", longopts, (int *) 0); | 405 | c = getopt_long(argc, argv, opts_spec, longopts, (int *) 0); |
| 390 | if (c == -1) { | 406 | if (c == -1) { |
| 391 | break; | 407 | break; |
| 392 | } | 408 | } |
| @@ -408,14 +424,18 @@ static void parse_opts(int argc, char **argv) | |||
| 408 | drop_privileges = 1; | 424 | drop_privileges = 1; |
| 409 | drop_user = optarg; | 425 | drop_user = optarg; |
| 410 | break; | 426 | break; |
| 427 | #ifdef HAVE_UDEV | ||
| 411 | case 'u': | 428 | case 'u': |
| 412 | opt_disable_hotplug = 1; | 429 | opt_disable_hotplug = 1; |
| 413 | opt_enable_exit = 1; | 430 | opt_enable_exit = 1; |
| 414 | break; | 431 | break; |
| 432 | #endif | ||
| 433 | #ifdef HAVE_SYSTEMD | ||
| 415 | case 's': | 434 | case 's': |
| 416 | opt_enable_exit = 1; | 435 | opt_enable_exit = 1; |
| 417 | foreground = 1; | 436 | foreground = 1; |
| 418 | break; | 437 | break; |
| 438 | #endif | ||
| 419 | case 'n': | 439 | case 'n': |
| 420 | opt_disable_hotplug = 1; | 440 | opt_disable_hotplug = 1; |
| 421 | break; | 441 | break; |
