]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
terminal-util: make file names in --cat-config output clickable links
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Jun 2018 13:43:59 +0000 (15:43 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 13 Jun 2018 12:20:03 +0000 (14:20 +0200)
src/basic/terminal-util.c

index 8b1d2e5dc574e343a08fc3ffdf0652f6d8021c8f..234a1722df7fafc0c2ea4679dca3dd3b113bb4d4 100644 (file)
@@ -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);