From 8d04b9617a5c8fc32ed26f787982999d6bfda14e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sat, 3 Feb 2007 00:12:05 +0100 Subject: inotail.c: Remember last printed header Prevents inotail from printing the header with the name of the file everytime it changes. --- inotail.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3-54-g00ecf