summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2020-03-11 13:28:51 +0100
committerFrantisek Sumsal <frantisek@sumsal.cz>2020-03-11 14:43:55 +0100
commitd171e679e7d4f380dceff39611a125b096babf00 (patch)
treec6bb827820ff855cc43e7adb6f1ba00610a3ed47 /src/systemctl
parent0080964cc87e8e2c9904816bf67198b9119ed473 (diff)
downloadsystemd-d171e679e7d4f380dceff39611a125b096babf00.tar.gz
systemctl: hide the 'glyph' column when --no-legend is requested
Fixes: #15077
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 146e2263f3..07f060e953 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -400,6 +400,12 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
return log_oom();
table_set_header(table, !arg_no_legend);
+ if (arg_no_legend) {
+ /* Hide the 'glyph' column when --no-legend is requested */
+ r = table_hide_column_from_display(table, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to hide column: %m");
+ }
if (arg_full)
table_set_width(table, 0);
@@ -461,12 +467,9 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
if (job_count == 0) {
/* There's no data in the JOB column, so let's hide it */
- /* Also, convert all number constants to size_t so va_arg()
- * in table_set_display() fetches a correct number of bytes from
- * the stack */
- r = table_set_display(table, (size_t) 0, (size_t) 1, (size_t) 2, (size_t) 3, (size_t) 4, (size_t) 6, (size_t) -1);
+ r = table_hide_column_from_display(table, 5);
if (r < 0)
- return log_error_errno(r, "Failed to set columns to display: %m");
+ return log_error_errno(r, "Failed to hide column: %m");
}
r = table_print(table, NULL);
@@ -1980,6 +1983,12 @@ static int output_machines_list(struct machine_info *machine_infos, unsigned n)
return log_oom();
table_set_header(table, !arg_no_legend);
+ if (arg_no_legend) {
+ /* Hide the 'glyph' column when --no-legend is requested */
+ r = table_hide_column_from_display(table, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to hide column: %m");
+ }
if (arg_full)
table_set_width(table, 0);