summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMantas MikulÄ—nas <grawity@gmail.com>2013-05-20 11:20:15 +0300
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-05-21 09:23:51 -0400
commit571bfc6c56962dfc926e9bbc1600c511fc8565d1 (patch)
tree21b9fb7ceb62053bb92fe4f216fb04a43d242672
parent1bec44f2a56c5d6fb827da9457d7470973acb8da (diff)
systemctl: honor "--no-legend" in 'list-sockets'
-rw-r--r--src/systemctl/systemctl.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3cca861cf6..e6bd855c15 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -655,11 +655,12 @@ static int output_sockets_list(struct socket_info *socket_infos, unsigned cs) {
}
if (cs) {
- printf("%-*s %-*.*s%-*s %s\n",
- pathlen, "LISTEN",
- typelen + arg_show_types, typelen + arg_show_types, "TYPE ",
- socklen, "UNIT",
- "ACTIVATES");
+ if (!arg_no_legend)
+ printf("%-*s %-*.*s%-*s %s\n",
+ pathlen, "LISTEN",
+ typelen + arg_show_types, typelen + arg_show_types, "TYPE ",
+ socklen, "UNIT",
+ "ACTIVATES");
for (s = socket_infos; s < socket_infos + cs; s++) {
char **a;
@@ -678,15 +679,18 @@ static int output_sockets_list(struct socket_info *socket_infos, unsigned cs) {
on = ansi_highlight(true);
off = ansi_highlight(false);
- printf("\n");
+ if (!arg_no_legend)
+ printf("\n");
} else {
on = ansi_highlight_red(true);
off = ansi_highlight_red(false);
}
- printf("%s%u sockets listed.%s\n", on, cs, off);
- if (!arg_all)
- printf("Pass --all to see loaded but inactive sockets, too.\n");
+ if (!arg_no_legend) {
+ printf("%s%u sockets listed.%s\n", on, cs, off);
+ if (!arg_all)
+ printf("Pass --all to see loaded but inactive sockets, too.\n");
+ }
return 0;
}