summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-10-18 22:55:12 +0200
committerLennart Poettering <lennart@poettering.net>2012-10-18 23:35:44 +0200
commitfd6e88753716d8136037277c7db2196e0f979675 (patch)
tree3856d9db5104ca7e7f4e285233b831441a4ad83a /src
parent0902aa1838ecf3b252ab0d02842ce4f9c1cab58d (diff)
journalctl: honour -n if -F is used
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;