summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-06-12 15:43:59 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-06-13 14:20:03 +0200
commit9539a9d3dbec4cc628584d7c279ffe110bf67ef7 (patch)
tree4e01bdbf5d98867daf1cbcdfa6fad7aa511c5c26
parentbinfmt,sysctl,sysuers,tmpfiles: add auto-paging for --cat-config commands (diff)
downloadsystemd-9539a9d3dbec4cc628584d7c279ffe110bf67ef7.tar.xz
systemd-9539a9d3dbec4cc628584d7c279ffe110bf67ef7.zip
terminal-util: make file names in --cat-config output clickable links
-rw-r--r--src/basic/terminal-util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index 8b1d2e5dc5..234a1722df 100644
--- a/src/basic/terminal-util.c
+++ b/src/basic/terminal-util.c
@@ -1376,16 +1376,21 @@ int terminal_urlify_path(const char *path, const char *text, char **ret) {
static int cat_file(const char *filename, bool newline) {
_cleanup_fclose_ FILE *f = NULL;
+ _cleanup_free_ char *urlified = NULL;
int r;
f = fopen(filename, "re");
if (!f)
return -errno;
+ r = terminal_urlify_path(filename, NULL, &urlified);
+ if (r < 0)
+ return r;
+
printf("%s%s# %s%s\n",
newline ? "\n" : "",
ansi_highlight_blue(),
- filename,
+ urlified,
ansi_normal());
fflush(stdout);