[master] 139a4ce Display EOF upon hitting end of input

Martin Blix Grydeland martin at varnish-software.com
Thu Jan 30 14:02:09 CET 2014


commit 139a4ce232ac7fe2fd2b96f41e25d44d58d6c2d1
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Thu Jan 30 13:51:09 2014 +0100

    Display EOF upon hitting end of input

diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index 3e94445..3bb12b3 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -62,6 +62,7 @@
 
 static const char progname[] = "varnishtop";
 static float period = 60; /* seconds */
+static int end_of_file = 0;
 
 struct top {
 	uint8_t			tag;
@@ -200,7 +201,11 @@ update(int p)
 	if (n < p)
 		n++;
 	AC(erase());
-	AC(mvprintw(0, 0, "%*s", COLS - 1, VUT.name));
+	if (end_of_file)
+		AC(mvprintw(0, COLS - 1 - strlen(VUT.name) - 5, "%s (EOF)",
+			VUT.name));
+	else
+		AC(mvprintw(0, COLS - 1 - strlen(VUT.name), "%s", VUT.name));
 	AC(mvprintw(0, 0, "list length %u", ntop));
 	for (tp = VRB_MIN(top_tree, &top_tree_head); tp != NULL; tp = tp2) {
 		tp2 = VRB_NEXT(top_tree, &top_tree_head, tp);
@@ -358,6 +363,7 @@ main(int argc, char **argv)
 	VUT.dispatch_f = &accumulate;
 	VUT.dispatch_priv = NULL;
 	VUT_Main();
+	end_of_file = 1;
 	if (once)
 		dump();
 	else



More information about the varnish-commit mailing list