]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: show empty cells as '-'
authorLennart Poettering <lennart@poettering.net>
Wed, 6 May 2020 12:47:46 +0000 (14:47 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 6 May 2020 13:40:15 +0000 (15:40 +0200)
This is mostly relevant for "systemct list-sockets" which can have empty
cells for the activating unit.

src/systemctl/systemctl.c

index 03b4d1b78357e541075f8c9bed5396d2f81b05ee..5c32147f14cc7198248c801b72ffeb1754c65dbd 100644 (file)
@@ -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();