From 920787cb7ce2a30002ebd053c15e94df5c2653df Mon Sep 17 00:00:00 2001 From: des Date: Sat, 16 Sep 2006 14:53:56 +0000 Subject: [PATCH] Rename -1 to -f, and add a -1 option meaning "once". It currently does not work very well; it should use a non-curses method to display the ranking. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1026 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishtop/varnishtop.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/varnish-cache/bin/varnishtop/varnishtop.c b/varnish-cache/bin/varnishtop/varnishtop.c index 0124e511..373ac0cf 100644 --- a/varnish-cache/bin/varnishtop/varnishtop.c +++ b/varnish-cache/bin/varnishtop/varnishtop.c @@ -86,12 +86,12 @@ main(int argc, char **argv) struct VSL_data *vd; unsigned u, v; struct top *tp, *tp2; - unsigned one_flag = 0; + int f_flag = 0; vd = VSL_New(); - while ((c = getopt(argc, argv, VSL_ARGS "1V")) != -1) { + while ((c = getopt(argc, argv, VSL_ARGS "1fV")) != -1) { i = VSL_Arg(vd, c, optarg); if (i < 0) exit (1); @@ -99,7 +99,10 @@ main(int argc, char **argv) continue; switch (c) { case '1': - one_flag = 1; + VSL_NonBlocking(vd, 1); + break; + case 'f': + f_flag = 1; break; case 'V': varnish_version("varnishtop"); @@ -130,7 +133,7 @@ main(int argc, char **argv) u = 0; q = p + 4; for (i = 0; i < p[1]; i++, q++) { - if (one_flag && (*q == ':' || isspace(*q))) + if (f_flag && (*q == ':' || isspace(*q))) break; u += *q; } -- 2.39.5