- unsigned id_len, max_id_len, load_len, active_len, sub_len, job_len, desc_len;
+ unsigned circle_len = 0, id_len, max_id_len, load_len, active_len, sub_len, job_len, desc_len;
}
if (!arg_full && original_stdout_is_tty) {
unsigned basic_len;
id_len = MIN(max_id_len, 25u);
}
if (!arg_full && original_stdout_is_tty) {
unsigned basic_len;
id_len = MIN(max_id_len, 25u);
for (u = unit_infos; u < unit_infos + c; u++) {
_cleanup_free_ char *e = NULL, *j = NULL;
for (u = unit_infos; u < unit_infos + c; u++) {
_cleanup_free_ char *e = NULL, *j = NULL;
- const char *on_loaded, *off_loaded, *on = "";
- const char *on_active, *off_active, *off = "";
+ const char *on_loaded = "", *off_loaded = "";
+ const char *on_active = "", *off_active = "";
+ const char *on_circle = "", *off_circle = "";
- if (streq(u->load_state, "error") ||
- streq(u->load_state, "not-found")) {
- on_loaded = on = ansi_highlight_red();
- off_loaded = off = ansi_highlight_off();
- } else
- on_loaded = off_loaded = "";
+ if (STR_IN_SET(u->load_state, "error", "not-found", "masked")) {
+ on_loaded = ansi_highlight_red();
+ on_circle = ansi_highlight_yellow();
+ off_loaded = off_circle = ansi_highlight_off();
+ circle = true;
+ }
- on_active = on = ansi_highlight_red();
- off_active = off = ansi_highlight_off();
- } else
- on_active = off_active = "";
+ on_circle = on_active = ansi_highlight_red();
+ off_circle = off_active = ansi_highlight_off();
+ circle = true;
+ }
if (u->machine) {
j = strjoin(u->machine, ":", u->id, NULL);
if (u->machine) {
j = strjoin(u->machine, ":", u->id, NULL);
on_loaded, load_len, u->load_state, off_loaded,
on_active, active_len, u->active_state,
sub_len, u->sub_state, off_active,
on_loaded, load_len, u->load_state, off_loaded,
on_active, active_len, u->active_state,
sub_len, u->sub_state, off_active,
"ACTIVE = The high-level unit activation state, i.e. generalization of SUB.\n"
"SUB = The low-level unit activation state, values depend on unit type.");
puts(job_count ? "JOB = Pending job for the unit.\n" : "");
"ACTIVE = The high-level unit activation state, i.e. generalization of SUB.\n"
"SUB = The low-level unit activation state, values depend on unit type.");
puts(job_count ? "JOB = Pending job for the unit.\n" : "");
namelen = sizeof("NAME") - 1,
statelen = sizeof("STATE") - 1,
failedlen = sizeof("FAILED") - 1,
namelen = sizeof("NAME") - 1,
statelen = sizeof("STATE") - 1,
failedlen = sizeof("FAILED") - 1,
statelen = MAX(statelen, m->state ? strlen(m->state) : 0);
failedlen = MAX(failedlen, DECIMAL_STR_WIDTH(m->n_failed_units));
jobslen = MAX(jobslen, DECIMAL_STR_WIDTH(m->n_jobs));
statelen = MAX(statelen, m->state ? strlen(m->state) : 0);
failedlen = MAX(failedlen, DECIMAL_STR_WIDTH(m->n_failed_units));
jobslen = MAX(jobslen, DECIMAL_STR_WIDTH(m->n_jobs));
- const char *on_state, *off_state, *on_failed, *off_failed;
+ const char *on_state = "", *off_state = "";
+ const char *on_failed = "", *off_failed = "";
+ bool circle = false;
if (streq_ptr(m->state, "degraded")) {
on_state = ansi_highlight_red();
off_state = ansi_highlight_off();
if (streq_ptr(m->state, "degraded")) {
on_state = ansi_highlight_red();
off_state = ansi_highlight_off();
} else if (!streq_ptr(m->state, "running")) {
on_state = ansi_highlight_yellow();
off_state = ansi_highlight_off();
} else if (!streq_ptr(m->state, "running")) {
on_state = ansi_highlight_yellow();
off_state = ansi_highlight_off();
if (m->is_host)
printf("%-*s (host) %s%-*s%s %s%*u%s %*u\n",
(int) (namelen - (sizeof(" (host)")-1)), strna(m->name),
if (m->is_host)
printf("%-*s (host) %s%-*s%s %s%*u%s %*u\n",
(int) (namelen - (sizeof(" (host)")-1)), strna(m->name),