int *fds;
const char *fmt;
+ int prev_fd;
INIT_G();
xwrite(STDOUT_FILENO, tailbuf, taillen);
}
} while (++i < nfiles);
+ prev_fd = fds[i-1];
tailbuf = xrealloc(tailbuf, BUFSIZ);
nread = tail_read(fd, tailbuf, BUFSIZ);
if (nread <= 0)
break;
- if (fmt) {
+ if (fmt && (fd != prev_fd)) {
tail_xprint_header(fmt, filename);
fmt = NULL;
+ prev_fd = fd;
}
xwrite(STDOUT_FILENO, tailbuf, nread);
}