diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2007-02-03 00:12:05 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@xenon.tklauser.home> | 2007-02-03 00:12:05 +0100 |
commit | 8d04b9617a5c8fc32ed26f787982999d6bfda14e (patch) | |
tree | cb2c3090780c0974006c788aff12b037758b0f43 | |
parent | 65cdbfabc03d13cfc831a767245d35596cd6ac52 (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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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) |