summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-10-19 19:43:44 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-19 19:43:47 +0200
commit688c6725017bf9b8b229bfc5823121858925c035 (patch)
tree6ba3694ae75cc68eeddbbe659c5dac82b56288a9
parentb772cfe0cccbcb52d6c4fc0a51cf9dfb39ecc3be (diff)
systemctl: fix counting in list-units output
https://bugzilla.redhat.com/show_bug.cgi?id=643502
-rw-r--r--src/systemctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/systemctl.c b/src/systemctl.c
index 555c171b0e..a03769034b 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -265,7 +265,7 @@ static bool output_show_job(const struct unit_info *u) {
}
static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
- unsigned active_len, sub_len, job_len;
+ unsigned active_len, sub_len, job_len, n_shown = 0;
const struct unit_info *u;
active_len = sizeof("ACTIVE")-1;
@@ -300,6 +300,8 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
if (!output_show_job(u))
continue;
+ n_shown++;
+
if (!streq(u->load_state, "loaded") &&
!streq(u->load_state, "banned")) {
on_loaded = ansi_highlight(true);
@@ -352,9 +354,9 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
"JOB = Pending job for the unit.\n");
if (arg_all)
- printf("\n%u units listed.\n", c);
+ printf("\n%u units listed.\n", n_shown);
else
- printf("\n%u units listed. Pass --all to see inactive units, too.\n", c);
+ printf("\n%u units listed. Pass --all to see inactive units, too.\n", n_shown);
}
}