diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-12-18 22:10:17 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-12-18 23:58:24 -0500 |
commit | a669d6226da35d8689898b57bcb6a449046e7a3c (patch) | |
tree | 5686381583819a451b5b2067c73806f897137c90 /src/systemctl | |
parent | 495cb9bbeb0bf2959f12e69253465a6aa03e7aef (diff) |
systemct: add empty line between units in cat
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index aab92c466f..d1f68754a9 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -3746,6 +3746,7 @@ static int cat(sd_bus *bus, char **args) { _cleanup_free_ char *unit = NULL, *n = NULL; int r = 0; char **name; + bool first = true; assert(bus); assert(args); @@ -3796,11 +3797,16 @@ static int cat(sd_bus *bus, char **args) { continue; } + if (first) + first = false; + else + puts(""); + if (!isempty(fragment_path)) { - fprintf(stdout, "%s# %s%s\n", - ansi_highlight_blue(), - fragment_path, - ansi_highlight_off()); + printf("%s# %s%s\n", + ansi_highlight_blue(), + fragment_path, + ansi_highlight_off()); fflush(stdout); r = sendfile_full(STDOUT_FILENO, fragment_path); @@ -3811,9 +3817,9 @@ static int cat(sd_bus *bus, char **args) { } STRV_FOREACH(path, dropin_paths) { - fprintf(stdout, "%s# %s\n", - isempty(fragment_path) && path == dropin_paths ? "" : "\n", - *path); + printf("%s# %s\n", + isempty(fragment_path) && path == dropin_paths ? "" : "\n", + *path); fflush(stdout); r = sendfile_full(STDOUT_FILENO, *path); |