Commit 139a4ce2 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Display EOF upon hitting end of input

parent 0ade45c1
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
static const char progname[] = "varnishtop"; static const char progname[] = "varnishtop";
static float period = 60; /* seconds */ static float period = 60; /* seconds */
static int end_of_file = 0;
struct top { struct top {
uint8_t tag; uint8_t tag;
...@@ -200,7 +201,11 @@ update(int p) ...@@ -200,7 +201,11 @@ update(int p)
if (n < p) if (n < p)
n++; n++;
AC(erase()); 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)); AC(mvprintw(0, 0, "list length %u", ntop));
for (tp = VRB_MIN(top_tree, &top_tree_head); tp != NULL; tp = tp2) { for (tp = VRB_MIN(top_tree, &top_tree_head); tp != NULL; tp = tp2) {
tp2 = VRB_NEXT(top_tree, &top_tree_head, tp); tp2 = VRB_NEXT(top_tree, &top_tree_head, tp);
...@@ -358,6 +363,7 @@ main(int argc, char **argv) ...@@ -358,6 +363,7 @@ main(int argc, char **argv)
VUT.dispatch_f = &accumulate; VUT.dispatch_f = &accumulate;
VUT.dispatch_priv = NULL; VUT.dispatch_priv = NULL;
VUT_Main(); VUT_Main();
end_of_file = 1;
if (once) if (once)
dump(); dump();
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment