mirror of
https://github.com/systemd/systemd.git
synced 2026-07-13 19:10:58 +00:00
journalctl: add --truncate-newline option
This commit is contained in:
committed by
Lennart Poettering
parent
9a109e7cd6
commit
61cecfa0d8
@@ -170,10 +170,15 @@ char *delete_trailing_chars(char *s, const char *bad) {
|
||||
return s;
|
||||
}
|
||||
|
||||
char *truncate_nl(char *s) {
|
||||
char *truncate_nl_full(char *s, size_t *ret_len) {
|
||||
size_t n;
|
||||
|
||||
assert(s);
|
||||
|
||||
s[strcspn(s, NEWLINE)] = 0;
|
||||
n = strcspn(s, NEWLINE);
|
||||
s[n] = '\0';
|
||||
if (ret_len)
|
||||
*ret_len = n;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user