From 9f03ab8e3ec603f2aed944a7887bcdf7be52009a Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 10 Oct 2012 16:49:28 +0200 Subject: MINOR: halog: add a parameter to limit output line count Sometimes it's useful to limit the output to a number of lines, for example when output is already sorted (eg: 10 slowest URLs, ...). Now we can use -m for this. (cherry picked from commit 667c905fe5153a8754bd8177c80dd9e6c245a0b0) [ this patch introduces a but that is fixed by commit a1629a59 ] --- contrib/halog/halog.c | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/contrib/halog/halog.c b/contrib/halog/halog.c index 3912807..7e16cd5 100644 --- a/contrib/halog/halog.c +++ b/contrib/halog/halog.c @@ -121,6 +121,7 @@ const char *line; int linenum = 0; int parse_err = 0; int lines_out = 0; +int lines_max = -1; const char *fgets2(FILE *stream); @@ -138,7 +139,7 @@ void usage(FILE *output, const char *msg) fprintf(output, "%s" "Usage: halog [-h|--help] for long help\n" - " halog [-q] [-c]\n" + " halog [-q] [-c] [-m ]\n" " {-cc|-gt|-pct|-st|-tc|-srv|-u|-uc|-ue|-ua|-ut|-uao|-uto|-uba|-ubt}\n" " [-s ] [-e|-E] [-H] [-rt|-RT