diff options
-rw-r--r-- | src/arm/gnunet-arm.c | 77 |
1 files changed, 76 insertions, 1 deletions
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index 954d31cfb..2670ac9b8 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c | |||
@@ -521,6 +521,11 @@ list_callback(void *cls, | |||
521 | unsigned int count, | 521 | unsigned int count, |
522 | const struct GNUNET_ARM_ServiceInfo *list) | 522 | const struct GNUNET_ARM_ServiceInfo *list) |
523 | { | 523 | { |
524 | unsigned int num_stopped = 0; | ||
525 | unsigned int num_started = 0; | ||
526 | unsigned int num_stopping = 0; | ||
527 | unsigned int num_failed = 0; | ||
528 | unsigned int num_finished = 0; | ||
524 | (void)cls; | 529 | (void)cls; |
525 | op = NULL; | 530 | op = NULL; |
526 | if (GNUNET_ARM_REQUEST_SENT_OK != rs) | 531 | if (GNUNET_ARM_REQUEST_SENT_OK != rs) |
@@ -544,12 +549,83 @@ list_callback(void *cls, | |||
544 | ret = 3; | 549 | ret = 3; |
545 | return; | 550 | return; |
546 | } | 551 | } |
552 | for (unsigned int i = 0; i < count; i++) | ||
553 | { | ||
554 | switch (list[i].status) | ||
555 | { | ||
556 | case GNUNET_ARM_SERVICE_STATUS_STOPPED: | ||
557 | num_stopped++; | ||
558 | break; | ||
559 | case GNUNET_ARM_SERVICE_STATUS_FAILED: | ||
560 | num_failed++; | ||
561 | break; | ||
562 | case GNUNET_ARM_SERVICE_STATUS_FINISHED: | ||
563 | num_finished++; | ||
564 | break; | ||
565 | case GNUNET_ARM_SERVICE_STATUS_STARTED: | ||
566 | num_started++; | ||
567 | break; | ||
568 | case GNUNET_ARM_SERVICE_STATUS_STOPPING: | ||
569 | num_stopping++; | ||
570 | fprintf(stdout, "%s (binary='%s', status=stopping)\n", list[i].name, list[i].binary); | ||
571 | break; | ||
572 | default: | ||
573 | GNUNET_break_op (0); | ||
574 | fprintf(stdout, "%s (binary='%s', status=unknown)\n", list[i].name, list[i].binary); | ||
575 | break; | ||
576 | } | ||
577 | } | ||
547 | if (!quiet) | 578 | if (!quiet) |
548 | { | 579 | { |
549 | if (show_all) | 580 | if (show_all) |
550 | fprintf(stdout, "%s", _("All services:\n")); | 581 | fprintf(stdout, "%s", _("All services:\n")); |
551 | else | 582 | else |
552 | fprintf(stdout, "%s", _("Services (excluding stopped services):\n")); | 583 | fprintf(stdout, "%s", _("Services (excluding stopped services):\n")); |
584 | if (num_stopped || num_failed || num_finished || num_stopping || num_started) | ||
585 | { | ||
586 | int sep = 0; | ||
587 | fprintf(stdout, "("); | ||
588 | if (0 != num_started) | ||
589 | { | ||
590 | if (sep) | ||
591 | fprintf(stdout, " / "); | ||
592 | fprintf(stdout, "started: %u", num_started); | ||
593 | sep = 1; | ||
594 | } | ||
595 | if (0 != num_failed) | ||
596 | { | ||
597 | if (sep) | ||
598 | fprintf(stdout, " / "); | ||
599 | fprintf(stdout, "failed: %u", num_failed); | ||
600 | sep = 1; | ||
601 | } | ||
602 | if (0 != num_stopping) | ||
603 | { | ||
604 | if (sep) | ||
605 | fprintf(stdout, " / "); | ||
606 | fprintf(stdout, "stopping: %u", num_stopping); | ||
607 | sep = 1; | ||
608 | } | ||
609 | if (0 != num_stopped) | ||
610 | { | ||
611 | if (sep) | ||
612 | fprintf(stdout, " / "); | ||
613 | fprintf(stdout, "stopped: %u", num_stopped); | ||
614 | sep = 1; | ||
615 | } | ||
616 | if (0 != num_finished) | ||
617 | { | ||
618 | if (sep) | ||
619 | fprintf(stdout, " / "); | ||
620 | fprintf(stdout, "finished: %u", num_finished); | ||
621 | sep = 1; | ||
622 | } | ||
623 | fprintf(stdout, ")\n"); | ||
624 | } | ||
625 | else | ||
626 | { | ||
627 | fprintf(stdout, "%s", _("(No services configured.)\n")); | ||
628 | } | ||
553 | } | 629 | } |
554 | for (unsigned int i = 0; i < count; i++) | 630 | for (unsigned int i = 0; i < count; i++) |
555 | { | 631 | { |
@@ -581,7 +657,6 @@ list_callback(void *cls, | |||
581 | GNUNET_break_op (0); | 657 | GNUNET_break_op (0); |
582 | fprintf(stdout, "%s (binary='%s', status=unknown)\n", list[i].name, list[i].binary); | 658 | fprintf(stdout, "%s (binary='%s', status=unknown)\n", list[i].name, list[i].binary); |
583 | break; | 659 | break; |
584 | |||
585 | } | 660 | } |
586 | } | 661 | } |
587 | al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL); | 662 | al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL); |