A patch from Erik Meusel <erik@wh58-709.st.uni-magdeburg.de>
authorEric Andersen <andersen@codepoet.org>
Tue, 26 Jun 2001 15:07:08 +0000 (15:07 -0000)
committerEric Andersen <andersen@codepoet.org>
Tue, 26 Jun 2001 15:07:08 +0000 (15:07 -0000)
to fix the behavior of 'tail -f -n 0 FILE'

coreutils/tail.c
tail.c

index 4fe92ba5e002a34eb900afe2aa4a15763cbd42e5..90cc2a6efad9e5d9e09ce90296953768eba99544 100644 (file)
@@ -127,6 +127,10 @@ int tail_main(int argc, char **argv)
        for (i = 0; i < nfiles; i++) {
                if (fds[i] == -1)
                        continue;
+               if (!count) {
+                       lseek(fds[i], 0, SEEK_END);
+                       continue;
+               }
                seen = 0;
                if (show_headers || (!hide_headers && nfiles > 1))
                        printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]);
diff --git a/tail.c b/tail.c
index 4fe92ba5e002a34eb900afe2aa4a15763cbd42e5..90cc2a6efad9e5d9e09ce90296953768eba99544 100644 (file)
--- a/tail.c
+++ b/tail.c
@@ -127,6 +127,10 @@ int tail_main(int argc, char **argv)
        for (i = 0; i < nfiles; i++) {
                if (fds[i] == -1)
                        continue;
+               if (!count) {
+                       lseek(fds[i], 0, SEEK_END);
+                       continue;
+               }
                seen = 0;
                if (show_headers || (!hide_headers && nfiles > 1))
                        printf("%s==> %s <==\n", i == 0 ? "" : "\n", argv[optind + i]);