This is basically a combination of the default (dump mode) and -f (follow mode). Specifying -F makes logread first dump the log buffer and then immediately start following it.
Signed-off-by: Phil Sutter <[email protected]> --- sysklogd/logread.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sysklogd/logread.c b/sysklogd/logread.c index bea73d9..1b17a97 100644 --- a/sysklogd/logread.c +++ b/sysklogd/logread.c @@ -83,7 +83,10 @@ int logread_main(int argc UNUSED_PARAM, char **argv) unsigned cur; int log_semid; /* ipc semaphore id */ int log_shmid; /* ipc shared memory id */ - smallint follow = getopt32(argv, "f"); + smallint follow, dumpfollow, args = getopt32(argv, "Ff"); + + dumpfollow = args & 0x1; + follow = args & 0x2; INIT_G(); @@ -129,7 +132,11 @@ int logread_main(int argc UNUSED_PARAM, char **argv) printf("cur:%u tail:%u size:%u\n", cur, shbuf_tail, shbuf_size); - if (!follow) { + if (!follow || dumpfollow) { + if (dumpfollow) { + follow = 1; + dumpfollow = 0; + } /* advance to oldest complete message */ /* find NUL */ cur += strlen(shbuf_data + cur); -- 1.8.5.5 _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
