summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2007-02-03 00:12:05 +0100
committerTobias Klauser <tklauser@xenon.tklauser.home>2007-02-03 00:12:05 +0100
commit8d04b9617a5c8fc32ed26f787982999d6bfda14e (patch)
treecb2c3090780c0974006c788aff12b037758b0f43
parent65cdbfabc03d13cfc831a767245d35596cd6ac52 (diff)
inotail.c: Remember last printed header
Prevents inotail from printing the header with the name of the file everytime it changes.
-rw-r--r--inotail.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/inotail.c b/inotail.c
index a53d1e5..9b37b55 100644
--- a/inotail.c
+++ b/inotail.c
@@ -101,9 +101,13 @@ static inline char *pretty_name(char *filename)
static void write_header(char *filename)
{
static unsigned short first_file = 1;
+ static char *last = NULL;
+
+ if (last != filename)
+ fprintf(stdout, "%s==> %s <==\n", (first_file ? "" : "\n"), pretty_name(filename));
- fprintf(stdout, "%s==> %s <==\n", (first_file ? "" : "\n"), pretty_name(filename));
first_file = 0;
+ last = filename;
}
static off_t lines_to_offset_from_end(struct file_struct *f, unsigned int n_lines)