r1026 - trunk/varnish-cache/bin/varnishtop

des at projects.linpro.no des at projects.linpro.no
Sat Sep 16 16:53:56 CEST 2006


Author: des
Date: 2006-09-16 16:53:56 +0200 (Sat, 16 Sep 2006)
New Revision: 1026

Modified:
   trunk/varnish-cache/bin/varnishtop/varnishtop.c
Log:
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.

Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c
===================================================================
--- trunk/varnish-cache/bin/varnishtop/varnishtop.c	2006-09-16 14:50:09 UTC (rev 1025)
+++ trunk/varnish-cache/bin/varnishtop/varnishtop.c	2006-09-16 14:53:56 UTC (rev 1026)
@@ -86,12 +86,12 @@
 	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,8 +99,11 @@
 			continue;
 		switch (c) {
 		case '1':
-			one_flag = 1;
+			VSL_NonBlocking(vd, 1);
 			break;
+		case 'f':
+			f_flag = 1;
+			break;
 		case 'V':
 			varnish_version("varnishtop");
 			exit(0);
@@ -130,7 +133,7 @@
 		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;
 		}




More information about the varnish-commit mailing list