summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/journal/journalctl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 5980eb0b48..7564c48e1f 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -926,11 +926,16 @@ int main(int argc, char *argv[]) {
SD_JOURNAL_FOREACH_UNIQUE(j, data, size) {
const void *eq;
+ if (arg_lines > 0 && n_shown >= arg_lines)
+ break;
+
eq = memchr(data, '=', size);
if (eq)
printf("%.*s\n", (int) (size - ((const uint8_t*) eq - (const uint8_t*) data + 1)), (const char*) eq + 1);
else
printf("%.*s\n", (int) size, (const char*) data);
+
+ n_shown ++;
}
r = 0;