From: Lennart Poettering Date: Wed, 6 May 2020 12:47:46 +0000 (+0200) Subject: systemctl: show empty cells as '-' X-Git-Tag: v246-rc1~429^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0773357ad1e3d9dbc10343137c0eccf402849d24;p=thirdparty%2Fsystemd.git systemctl: show empty cells as '-' This is mostly relevant for "systemct list-sockets" which can have empty cells for the activating unit. --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 03b4d1b7835..5c32147f14c 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -425,6 +425,8 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) { if (arg_full) table_set_width(table, 0); + (void) table_set_empty_string(table, "-"); + for (u = unit_infos; unit_infos && u < unit_infos + c; u++) { _cleanup_free_ char *j = NULL; const char *on_underline = "", *on_loaded = "", *on_active = ""; @@ -1021,6 +1023,8 @@ static int output_sockets_list(struct socket_info *socket_infos, unsigned cs) { if (arg_full) table_set_width(table, 0); + (void) table_set_empty_string(table, "-"); + if (cs) { for (s = socket_infos; s < socket_infos + cs; s++) { _cleanup_free_ char *j = NULL, *activates = NULL; @@ -1265,6 +1269,8 @@ static int output_timers_list(struct timer_info *timer_infos, unsigned n) { if (arg_full) table_set_width(table, 0); + (void) table_set_empty_string(table, "-"); + if (n > 0) { for (t = timer_infos; t < timer_infos + n; t++) { _cleanup_free_ char *j = NULL, *activates = NULL; @@ -1478,6 +1484,8 @@ static int output_unit_file_list(const UnitFileList *units, unsigned c) { if (arg_full) table_set_width(table, 0); + (void) table_set_empty_string(table, "-"); + for (const UnitFileList *u = units; u < units + c; u++) { const char *on_underline = NULL, *on_unit_color = NULL, *id; bool underline; @@ -2031,6 +2039,8 @@ static int output_machines_list(struct machine_info *machine_infos, unsigned n) if (arg_full) table_set_width(table, 0); + (void) table_set_empty_string(table, "-"); + for (m = machine_infos; m < machine_infos + n; m++) { _cleanup_free_ char *mname = NULL; const char *on_state = "", *on_failed = ""; @@ -2351,6 +2361,8 @@ static int output_jobs_list(sd_bus *bus, const struct job_info* jobs, unsigned n if (arg_full) table_set_width(table, 0); + (void) table_set_empty_string(table, "-"); + for (j = jobs; j < jobs + n; j++) { if (streq(j->state, "running")) on = ansi_highlight();