journalctl: add highlighting for matched substring

Red is used for highligting, the same as grep does. Except when the line is
highlighted red already, because it has high priority, in which case plain ansi
highlight is used for the matched substring.

Coloring is implemented for short and cat outputs, and not for other types.
I guess we could also add it for verbose output in the future.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-01-28 14:50:01 +01:00
parent 61c5f8a1f0
commit b4766d5f15
7 changed files with 114 additions and 28 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ char* strshorten(char *s, size_t l);
char *strreplace(const char *text, const char *old_string, const char *new_string);
char *strip_tab_ansi(char **p, size_t *l);
char *strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]);
char *strextend_with_separator(char **x, const char *separator, ...) _sentinel_;