summaryrefslogtreecommitdiff
path: root/inotail.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2007-06-24 20:08:58 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2007-06-24 20:08:58 +0200
commit86bad98403604f4738e8c252519755654f954eb0 (patch)
tree96102eb6a267573c309decc39da6da6b21c1606a /inotail.c
parent8748c6cedcd5d2d9c23a1c4b5aa019c82b735f90 (diff)
inotail.c: Flush stdout in write_header()
To make sure the header is also printed when piping inotail output to pipes.
Diffstat (limited to 'inotail.c')
-rw-r--r--inotail.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/inotail.c b/inotail.c
index 6a000f7..8fcf9fd 100644
--- a/inotail.c
+++ b/inotail.c
@@ -119,8 +119,10 @@ static void write_header(char *filename)
static unsigned short first_file = 1;
static char *last = NULL;
- if (last != filename)
+ if (last != filename) {
fprintf(stdout, "%s==> %s <==\n", (first_file ? "" : "\n"), pretty_name(filename));
+ fflush(stdout); /* Make sure the header is printed before the content */
+ }
first_file = 0;
last = filename;