diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index 13f9d79c9a89..0d9ff8d3e1b7 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -246,13 +246,13 @@ rlines(fp, off, sbp) static void show(file_info_t *file) { - int ch, first; + int ch; + static file_info_t *last; - first = 1; while ((ch = getc(file->fp)) != EOF) { - if (first && no_files > 1) { + if (last != file && no_files > 1) { (void)printf("\n==> %s <==\n", file->file_name); - first = 0; + last = file; } if (putchar(ch) == EOF) oerr();