chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0ced77d
)
terminal-util: make file names in --cat-config output clickable links
author
Lennart Poettering
<lennart@poettering.net>
Tue, 12 Jun 2018 13:43:59 +0000
(15:43 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000
(16:47 +0200)
src/basic/terminal-util.c
patch
|
blob
|
history
diff --git
a/src/basic/terminal-util.c
b/src/basic/terminal-util.c
index f6dff6d3562404fb038eb9c94e019de1791191a3..18cfb4c7550de16847ea638ec19ce61f3770161f 100644
(file)
--- a/
src/basic/terminal-util.c
+++ b/
src/basic/terminal-util.c
@@
-1395,16
+1395,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;
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;
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(),
printf("%s%s# %s%s\n",
newline ? "\n" : "",
ansi_highlight_blue(),
-
filename
,
+
urlified
,
ansi_normal());
fflush(stdout);
ansi_normal());
fflush(stdout);