summaryrefslogtreecommitdiff
path: root/src/logs-show.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-01-14 03:07:47 +0100
committerLennart Poettering <lennart@poettering.net>2012-01-14 03:07:47 +0100
commite6acda19b26e5a8e490b48b15e2ba33d9103b3bd (patch)
tree51d508ce74d3ae2ae1a3af0a49363ec0d0bbeb17 /src/logs-show.c
parent32895bb39049b7d5c244a2e4201f47077bfa8b12 (diff)
journal: when show blob data show length
Diffstat (limited to 'src/logs-show.c')
-rw-r--r--src/logs-show.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/logs-show.c b/src/logs-show.c
index 8d1c77e5c3..5a00133140 100644
--- a/src/logs-show.c
+++ b/src/logs-show.c
@@ -225,9 +225,10 @@ static int output_short(sd_journal *j, unsigned line, bool show_all, bool monoto
if (show_all)
printf(": %.*s\n", (int) message_len, message);
- else if (contains_unprintable(message, message_len))
- fputs(": [blob data]\n", stdout);
- else if (message_len + n < columns())
+ else if (contains_unprintable(message, message_len)) {
+ char bytes[FORMAT_BYTES_MAX];
+ printf(": [%s blob data]\n", format_bytes(bytes, sizeof(bytes), message_len));
+ } else if (message_len + n < columns())
printf(": %.*s\n", (int) message_len, message);
else if (n < columns()) {
char *e;
@@ -298,6 +299,7 @@ static int output_verbose(sd_journal *j, unsigned line, bool show_all) {
if (!show_all && (length > PRINT_THRESHOLD ||
contains_unprintable(data, length))) {
const char *c;
+ char bytes[FORMAT_BYTES_MAX];
c = memchr(data, '=', length);
if (!c) {
@@ -305,9 +307,10 @@ static int output_verbose(sd_journal *j, unsigned line, bool show_all) {
return -EINVAL;
}
- printf("\t%.*s=[blob data]\n",
+ printf("\t%.*s=[%s blob data]\n",
(int) (c - (const char*) data),
- (const char*) data);
+ (const char*) data,
+ format_bytes(bytes, sizeof(bytes), length - (c - (const char *) data) - 1));
} else
printf("\t%.*s\n", (int) length, (const char*) data);
}